mirror of
https://github.com/infeng/react-viewer.git
synced 2025-12-08 17:36:40 +00:00
45 lines
984 B
JavaScript
45 lines
984 B
JavaScript
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;
|
|
}; |