-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
45 lines (36 loc) · 958 Bytes
/
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
var webpack = require('atool-build/lib/webpack');
module.exports = function(webpackConfig, dev) {
webpackConfig.plugins.some(function(plugin, i){
if(plugin instanceof webpack.optimize.CommonsChunkPlugin) {
webpackConfig.plugins.splice(i, 1);
return true;
}
});
if (dev) {
return webpackConfig;
}
// Fix ie8 compatibility
webpackConfig.module.loaders.unshift({
test: /\.jsx?$/,
loader: 'es3ify-loader',
});
// build UMD files
webpackConfig.entry = {
index: './index.js',
};
webpackConfig.externals = {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
};
webpackConfig.output.library = 'componentStore';
webpackConfig.output.libraryTarget = 'umd';
webpackConfig.plugins = webpackConfig.plugins
.filter((plugin) => {
return !(plugin instanceof webpack.optimize.UglifyJsPlugin);
});
return webpackConfig;
};