-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
50 lines (49 loc) · 1.66 KB
/
webpack.config.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
43
44
45
46
47
48
49
50
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
entry: {
mod: './src/entry/index',
'resolver-amd': './src/entry/amd',
'resolver-global': './src/entry/global',
'resolver-cjs': './src/entry/cjs',
'resolver-css-lazy': './src/entry/css-lazy',
'resolver-style-lazy': './src/entry/style-lazy',
'resolver-wasm': './src/entry/wasm',
'resolver-raw': './src/entry/raw',
'resolver-json': './src/entry/json'
},
output: {
filename: process.env.POLYFILL ? '[name].polyfill.min.js' : '[name].min.js'
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json']
},
mode: process.env.NODE_ENV,
devtool: process.env.NODE_ENV === 'development' ? 'inline-source-map' : 'source-map',
devServer: {
contentBase: './dist',
headers: {
'Access-Control-Allow-Origin': '*'
}
},
plugins: [...(process.env.ANALYZER ? [new BundleAnalyzerPlugin()] : [])],
module: {
rules: [
{
oneOf: [
{
test: /(\.js|\.jsx|\.ts|\.tsx)$/,
use: [
{
loader: 'babel-loader',
options: process.env.POLYFILL
? require('./.babelrc.polyfill.js')
: require('./babel.config.js')
}
],
exclude: /node_modules/
}
]
}
]
}
};