-
Notifications
You must be signed in to change notification settings - Fork 239
Expand file tree
/
Copy pathwebpack.config.js
More file actions
78 lines (77 loc) · 2.06 KB
/
Copy pathwebpack.config.js
File metadata and controls
78 lines (77 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
module.exports = (env, argv) => {
const mode = argv.mode === 'production' ? 'prod' : 'dev';
const maxAssetSize = mode === 'prod' ? 360000 : 1512000;
return {
target: ['web', 'es2020'],
entry: {
index: path.resolve(__dirname, 'src/index.js'),
},
resolve: {
alias: {
'react-intl$': path.resolve(__dirname, 'src/lib/react-intl-compat.js'),
'react-intl-original$': path.resolve(__dirname, 'node_modules/react-intl'),
},
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.jsx?$/,
use: [
{
loader: 'babel-loader',
options: {
envName: mode === 'prod' ? 'production' : 'development',
},
},
],
exclude: /node_modules/,
},
],
},
output: {
path: path.resolve(__dirname, 'umd'),
filename: `[name].${mode}.js`,
publicPath: '/umd/',
module: true
},
experiments: {
outputModule: true,
},
optimization: {
runtimeChunk: 'single',
minimize: (mode === 'prod'),
minimizer: ['...']
},
performance: {
maxEntrypointSize: maxAssetSize,
maxAssetSize: maxAssetSize,
assetFilter: function(assetFilename) {
// Exclude all sourcemaps
if (/\.map$/.test(assetFilename)) {
return false;
}
return true;
},
},
plugins: [
new CopyPlugin({
patterns: [
{ from: `node_modules/tinode-sdk/umd/tinode.${mode}.js`, to: `tinode.${mode}.js` },
{ from: `node_modules/tinode-sdk/umd/tinode.${mode}.js.map`, to: `tinode.${mode}.js.map` },
],
}),
],
externalsType: 'module',
externals: {
'livekit-client': 'var LivekitClient',
'qrcodejs': 'var QRCode',
'react': 'react',
'react-dom/client': 'react-dom/client',
'react-intl-original': 'react-intl-original',
'tinode-sdk': 'var tinode',
},
};
}