...
|
...
|
@@ -228,8 +228,10 @@ gulp.task('webpack-dev-server', () => { |
|
|
devConfig.output.publicPath = 'http://localhost:5001/';
|
|
|
|
|
|
// 开发环境插件
|
|
|
devConfig.plugins[0] = new ExtractTextPlugin('bundle/[name].css');
|
|
|
devConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
|
|
|
devConfig.plugins.push(
|
|
|
new ExtractTextPlugin('bundle/[name].css'),
|
|
|
new webpack.HotModuleReplacementPlugin()
|
|
|
);
|
|
|
|
|
|
devConfig.entry.libs.unshift(`webpack-dev-server/client?${devConfig.output.publicPath}`, 'webpack/hot/dev-server');
|
|
|
|
...
|
...
|
@@ -281,13 +283,16 @@ gulp.task('webpack', ['assets'], (done) => { |
|
|
proConfig.output.path = dist.js;
|
|
|
|
|
|
// 生产环境插件
|
|
|
proConfig.plugins.push(new webpack.DefinePlugin({
|
|
|
proConfig.plugins.push(
|
|
|
new webpack.DefinePlugin({
|
|
|
'process.env': {
|
|
|
NODE_ENV: '"production"'
|
|
|
}
|
|
|
}), new UglifyJsParallelPlugin({
|
|
|
}),
|
|
|
new UglifyJsParallelPlugin({
|
|
|
workers: os.cpus().length
|
|
|
}));
|
|
|
})
|
|
|
);
|
|
|
|
|
|
webpack(proConfig, (err, stats) => {
|
|
|
if (err) {
|
...
|
...
|
|