vueパッケージにバージョン番号を付ける
vueパッケージはランダム文字列をファイル名として使用し、静的リソースのタイムリーな更新を制御しますが、ブラウザは更新せず、静的リソースを導入した後にバージョン番号を追加することができます.
vue-cli 2.0
build/webpackを変更します.Prod.conf.js、HtmlWebpackPluginプラグイン構成項目にhash:trueを追加
vue-cli 3.0
vueを変更します.config.js、このファイルがなければ手動で追加
vue-cli 2.0
build/webpackを変更します.Prod.conf.js、HtmlWebpackPluginプラグイン構成項目にhash:trueを追加
new HtmlWebpackPlugin({
filename: process.env.NODE_ENV === 'testing'
? 'index.html'
: config.build.index,
template: 'index.html',
inject: true,
hash: true, //
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
},
chunksSortMode: 'dependency'
})
vue-cli 3.0
vueを変更します.config.js、このファイルがなければ手動で追加
module.exports = {
filenameHashing: true
}