我看vue-cli里的默认配置,css和js的名字都加了哈希值
还会有缓存问题应该是index.html缓存,但是查教程的时候发现,很多建议去掉默认hash,给文件名添加时间戳,想知道这么做是否有必要?
module.exports = {
filenameHashing:false, // 打包的时候不使用hash值.因为我们有时间戳来确定项目的唯一性了.
//
configureWebpack: { //重点
output: { // 输出重构 打包编译后的js文件名称,添加时间戳.
filename: `js[name].${ timeStamp }.js`,
chunkFilename: `js[name].${ timeStamp }.js`,
}
},
css: { //重点.
extract:{ // 打包后css文件名称添加时间戳
filename:`css/[name].${ timeStamp }.css`,
chunkFilename:`css/[name].${ timeStamp }.css`,
}
}
};
还有对于index.html缓存问题添加如下meta字段,为什么还要配置ngnix add_header Cache-Control "no-cache, no-store"
这样是否重复,有什么意义?
<!-- 处理浏览器缓存 -->
<meta http-equiv="pragram" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="expires" content="0">
###