Skip to content

Commit

Permalink
fix: revert file name hashing in dev mode
Browse files Browse the repository at this point in the history
closes #2492

The change was intended to mitigate the problem that Safari keeps caching
dev bundles.

But it caused several unintended bugs:
1. [Hashes in file names with HMR enabled might cause memory leaks](webpack/webpack-dev-server#377 (comment))
2. Moving the hash to file query also breaks many webpack loaders:
  1. [mocha-webpack](f683583)
  2. [django-webpack-loader](#2492))

So till we find a better way to solve this issue, hashes in dev bundles
should be removed.
  • Loading branch information
haoqunjiang committed Sep 12, 2018
1 parent 69cec80 commit 32346b8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions packages/@vue/cli-plugin-unit-mocha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ module.exports = api => {
options.optimizeSSR = false
return options
})

const isLegacyBundle = process.env.VUE_CLI_MODERN_MODE && !process.env.VUE_CLI_MODERN_BUILD
// mocha-webpack cannot deal with the query parameter in filename
webpackConfig
.output
.filename(isLegacyBundle ? '[name]-legacy.js?' : '[name].js')
}
})

Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-service/lib/config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = (api, options) => {
.end()
.output
.path(api.resolve(options.outputDir))
.filename(isLegacyBundle ? '[name]-legacy.js?[hash:8]' : '[name].js?[hash:8]')
.filename(isLegacyBundle ? '[name]-legacy.[hash:8].js' : '[name].[hash:8].js')
.publicPath(options.baseUrl)

webpackConfig.resolve
Expand Down

0 comments on commit 32346b8

Please sign in to comment.