refactor: dev optimizations
This commit is contained in:
@@ -5,6 +5,7 @@ const webpack = require('webpack')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const NameAllModulesPlugin = require('name-all-modules-plugin')
|
||||
|
||||
const babelConfig = fs.readJsonSync(path.join(process.cwd(), '.babelrc'))
|
||||
const postCSSConfig = {
|
||||
@@ -182,6 +183,13 @@ module.exports = {
|
||||
{ from: 'client/static' }
|
||||
], {
|
||||
|
||||
}),
|
||||
new webpack.NamedModulesPlugin(),
|
||||
new webpack.NamedChunksPlugin((chunk) => {
|
||||
if (chunk.name) {
|
||||
return chunk.name
|
||||
}
|
||||
return chunk.modules.map(m => path.relative(m.context, m.request)).join('_')
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
@@ -190,9 +198,10 @@ module.exports = {
|
||||
}
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'manifest',
|
||||
name: 'runtime',
|
||||
minChunks: Infinity
|
||||
})
|
||||
}),
|
||||
new NameAllModulesPlugin()
|
||||
],
|
||||
resolve: {
|
||||
symlinks: true,
|
||||
|
@@ -1,6 +1,5 @@
|
||||
const webpack = require('webpack')
|
||||
const merge = require('webpack-merge')
|
||||
const path = require('path')
|
||||
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
|
||||
|
@@ -4,6 +4,7 @@ const merge = require('webpack-merge')
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin')
|
||||
|
||||
const common = require('./webpack.common.js')
|
||||
|
||||
@@ -19,6 +20,7 @@ module.exports = merge(common, {
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify('production')
|
||||
}),
|
||||
new ExtractTextPlugin('css/bundle.css')
|
||||
new ExtractTextPlugin('css/bundle.css'),
|
||||
new DuplicatePackageCheckerPlugin()
|
||||
]
|
||||
})
|
||||
|
Reference in New Issue
Block a user