improve webpack chunk namings

This commit is contained in:
Pooya Parsa 2017-08-16 15:06:27 +04:30
parent db19b50a02
commit e510136a5a
2 changed files with 9 additions and 5 deletions

View File

@ -119,10 +119,11 @@ export default function webpackClientConfig () {
// Add friendly error plugin
config.plugins.push(new FriendlyErrorsWebpackPlugin())
// https://webpack.js.org/plugins/named-modules-plugin
config.plugins.push(new webpack.NamedModulesPlugin())
// Add HMR support
config.entry.app = ['webpack-hot-middleware/client?name=$client&reload=true', config.entry.app]
config.output.filename = '[name].js'
config.output.chunkFilename = '[id].js'
config.plugins.push(
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
@ -143,6 +144,9 @@ export default function webpackClientConfig () {
})
)
// https://webpack.js.org/plugins/hashed-module-ids-plugin
config.plugins.push(new webpack.HashedModuleIdsPlugin())
// Webpack Bundle Analyzer
if (this.options.build.analyze) {
config.plugins.push(

View File

@ -159,9 +159,9 @@ Options.defaults = {
filenames: {
css: 'common.[contenthash].css',
manifest: 'manifest.[hash].js',
vendor: 'vendor.bundle.[chunkhash].js',
app: 'nuxt.bundle.[chunkhash].js',
chunk: '[id].nuxt.bundle.[chunkhash].js'
vendor: 'vendor.[chunkhash].js',
app: 'app.[chunkhash].js',
chunk: '[name].[chunkhash].js'
},
vendor: [],
plugins: [],