Skip to content

Commit

Permalink
improve webpack chunk namings
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Aug 16, 2017
1 parent db19b50 commit e510136
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions lib/builder/webpack/client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions lib/common/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [],
Expand Down

0 comments on commit e510136

Please sign in to comment.