Showing
1 changed file
with
10 additions
and
5 deletions
@@ -228,8 +228,10 @@ gulp.task('webpack-dev-server', () => { | @@ -228,8 +228,10 @@ gulp.task('webpack-dev-server', () => { | ||
228 | devConfig.output.publicPath = 'http://localhost:5001/'; | 228 | devConfig.output.publicPath = 'http://localhost:5001/'; |
229 | 229 | ||
230 | // 开发环境插件 | 230 | // 开发环境插件 |
231 | - devConfig.plugins[0] = new ExtractTextPlugin('bundle/[name].css'); | ||
232 | - devConfig.plugins.push(new webpack.HotModuleReplacementPlugin()); | 231 | + devConfig.plugins.push( |
232 | + new ExtractTextPlugin('bundle/[name].css'), | ||
233 | + new webpack.HotModuleReplacementPlugin() | ||
234 | + ); | ||
233 | 235 | ||
234 | devConfig.entry.libs.unshift(`webpack-dev-server/client?${devConfig.output.publicPath}`, 'webpack/hot/dev-server'); | 236 | devConfig.entry.libs.unshift(`webpack-dev-server/client?${devConfig.output.publicPath}`, 'webpack/hot/dev-server'); |
235 | 237 | ||
@@ -281,13 +283,16 @@ gulp.task('webpack', ['assets'], (done) => { | @@ -281,13 +283,16 @@ gulp.task('webpack', ['assets'], (done) => { | ||
281 | proConfig.output.path = dist.js; | 283 | proConfig.output.path = dist.js; |
282 | 284 | ||
283 | // 生产环境插件 | 285 | // 生产环境插件 |
284 | - proConfig.plugins.push(new webpack.DefinePlugin({ | 286 | + proConfig.plugins.push( |
287 | + new webpack.DefinePlugin({ | ||
285 | 'process.env': { | 288 | 'process.env': { |
286 | NODE_ENV: '"production"' | 289 | NODE_ENV: '"production"' |
287 | } | 290 | } |
288 | - }), new UglifyJsParallelPlugin({ | 291 | + }), |
292 | + new UglifyJsParallelPlugin({ | ||
289 | workers: os.cpus().length | 293 | workers: os.cpus().length |
290 | - })); | 294 | + }) |
295 | + ); | ||
291 | 296 | ||
292 | webpack(proConfig, (err, stats) => { | 297 | webpack(proConfig, (err, stats) => { |
293 | if (err) { | 298 | if (err) { |
-
Please register or login to post a comment