当前位置:网站首页>vue项目 npm run build 打包项目防止浏览器缓存
vue项目 npm run build 打包项目防止浏览器缓存
2022-08-10 02:45:00 【船长在船上】
在vue.config.js配置
推荐方法1:
const Timestamp = new Date().getTime()
module.exports = {
......
configureWebpack: config => {
config.output.filename = `js/[name].${Timestamp}.js`
config.output.chunkFilename = `js/[name].${Timestamp}.js`
},
......
css: {
......
extract: {
filename: `css/[name].${Timestamp}.css`,
chunkFilename: `css/[name].${Timestamp}.css`
}
......
}
}
方法2:index.html页面添加
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
这样添加会导致了用户每次访问你的程序时都要重新请求服务器,所有的静态资源都无法用缓存了,浪费流量,网络压力变大。
边栏推荐
猜你喜欢
T5: Text-to-Text Transfer Transformer
“双枪”木马病毒的进化史
过水滑环的结构和工作原理
【Image Classification】2022-ResMLP
yolov5+usb相机
Robust Real-time LiDAR-inertial Initialization(实时鲁棒的LiDAR惯性初始化)论文学习
高精度加法
使用curl指令发起websocket请求
The Evolutionary History of the "Double Gun" Trojan Horse Virus
Anchor_generators.py analysis of MMDetection framework
随机推荐
[Semantic Segmentation] 2022-HRViT CVPR
Example 047: Functions Swap Variables
yolov5+usb相机
二进制与内存
国能准能集团研发矿山数字孪生系统 填补国内采矿行业空白
2022.8.9 Remainder of Exam Balance--1000 Question Solutions
元宇宙+NFT是“宝”还是“炒”
【图像分类】2022-ResMLP
【Image Classification】2022-ResMLP
兴业数金一面
what is eabi
Arcgis进阶篇(1)——安装Arcgis Enterprise,创建sde库
What makes training multi-modal classification networks hard?
网页挖矿溯源?浏览器浏览历史查看工具Browsinghistoryview
[8.8] Code Source - [Non-falling subarray game] [Longest rising subsequence count (Bonus)] [Substring (data enhanced version)]
从滑动标尺模型看企业网络安全能力评估与建设
HACKTHEBOX——Bank
flutter 每天一背,需要掌握
书法家唐效奇
Instance 042: Variable scope