-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (32 loc) · 1.04 KB
/
index.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
const webpack = require('webpack');
const AutoDllPlugin = require('autodll-webpack-plugin');
function createRewireDll({ entry, path, filename }) {
const autodllConfig = { inject: true, entry: entry || {} };
if (path) autodllConfig.path = path;
if (filename) autodllConfig.filename = filename;
return function rewireDll(config, env) {
autodllConfig.plugins = [
new webpack.optimize.UglifyJsPlugin({
compress: {
unused: true,
dead_code: true,
warnings: false,
drop_console: true,
comparisons: false
},
output: {
comments: false,
// Turned on because emoji and regex is not minified properly using default
// https://github.com/facebookincubator/create-react-app/issues/2488
ascii_only: true
}
})
];
// https://github.com/webpack/webpack/issues/5478
config.plugins = (config.plugins || []).concat(
new AutoDllPlugin(autodllConfig)
);
return config;
};
}
module.exports = createRewireDll;