-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
48 lines (44 loc) · 1.13 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
const webpackMerge = require('webpack-merge');
const commonConfig = require('./build/webpack.common.config');
const webpack = require('webpack');
const path = require('path');
const configs = {
dev: require('./build/webpack.dev.config'),
pro: require('./build/webpack.pro.config'),
none: {
mode: 'development',
devtool: false,
cache: {
type: 'filesystem',
},
performance: {
maxEntrypointSize: 2500000,
maxAssetSize: 2500000,
},
plugins: [
// new BundleAnalyzerPlugin(),
new webpack.DefinePlugin({
'process.env.BUILD_ENV': JSON.stringify('DEV'),
}),
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
],
resolve: {
fallback: {
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
buffer: require.resolve('buffer'),
url: require.resolve('url/'),
},
},
},
};
const config = (env) => {
if (env.config) {
return webpackMerge.merge(commonConfig, configs[env.config]);
}
return commonConfig;
};
module.exports = config;