-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
45 lines (37 loc) · 984 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
const webpack = require('atool-build/lib/webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var conf = {
filename: 'index.html',
template: './demo/index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: false
},
hash: true,
}
module.exports = function (webpackConfig) {
webpackConfig.babel.plugins.push(['import', {
libraryName: 'antd',
style: true,
}]);
webpackConfig.entry = {
index: './demo/index.tsx',
};
webpackConfig.output.publicPath = '/';
webpackConfig.module.loaders.forEach(function (loader, index) {
if (loader.test.toString().indexOf('html') > 0) {
loader.loader = 'html';
}
});
webpackConfig.plugins.push(
new HtmlWebpackPlugin(conf)
);
webpackConfig.plugins.some(function (plugin, i) {
if (plugin instanceof webpack.optimize.CommonsChunkPlugin) {
webpackConfig.plugins.splice(i, 1);
return true;
}
});
return webpackConfig;
};