当前位置:网站首页>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">
这样添加会导致了用户每次访问你的程序时都要重新请求服务器,所有的静态资源都无法用缓存了,浪费流量,网络压力变大。
边栏推荐
猜你喜欢
随机推荐
[Semantic Segmentation] 2022-HRViT CVPR
GDB之指令基础参数
Excel Advanced Drawing Skills 100 Lectures (23) - Countdown Counting in Excel
【红队】ATT&CK - 自启动 - 注册表运行键、启动文件夹
yolov5+usb相机
Example 045: Summation
【Image Classification】2022-ResMLP
flutter 制作嵌套列表
2022/08/09 学习笔记 (day26) IO流
【CC3200AI 实验教程5】疯壳·AI语音人脸识别(会议记录仪/人脸打卡机)-定时器
《天才基本法》:平行时空的第二次选择,小演员的表现意外出圈
关于redis在业务中的应用问题,如何解决?
State compression small experience
论旅行之收获
Introduction and application of quantitative trading strategies
2022.8.8考试区域链接(district)题解
新零售社交电商APP系统平台如何打造公域+私域流量?
网页挖矿溯源?浏览器浏览历史查看工具Browsinghistoryview
what is a microcontroller or mcu
HackTheBox——Beep








