-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.common.js
42 lines (39 loc) · 1.15 KB
/
webpack.config.common.js
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
const path = require('path');
const webpack = require('webpack');
const srcdir = path.resolve(__dirname, 'src/main/frontend');
const entries = {
index: path.join(srcdir, 'entry/index.tsx'),
demo: path.join(srcdir, 'entry/demo.tsx'),
'example/demo': path.join(srcdir, 'entry/example/demo.tsx'),
};
module.exports = {
entry: entries,
output: {
publicPath: '/static/bundle/',
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.css'],
modules: [srcdir, 'node_modules'],
},
optimization: {
splitChunks: {
cacheGroups: {
default: false,
vendors: false,
common: {
chunks: 'initial',
name: 'common',
test: (chunks) =>
chunks.resource &&
!/^.*\.(css|scss)$/.test(chunks.resource) &&
/node_modules/.test(chunks.context),
},
vendor: {
name: 'vendor',
test: 'vendor',
enforce: true,
},
},
},
},
};