当前位置:网站首页>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">
这样添加会导致了用户每次访问你的程序时都要重新请求服务器,所有的静态资源都无法用缓存了,浪费流量,网络压力变大。
边栏推荐
- Leetcode 47 全排列Ⅱ
- GDB command basic parameters
- 2022.8.8考试清洁工老马(sweeper)题解
- MySQL:日志系统介绍 | 错误日志 | 查询日志 | 二进制日志:bin-log数据恢复实践 | 慢日志查询
- Instance 042: Variable scope
- excel高级绘图技巧100讲(二十三)-Excel中实现倒计时计数
- HACKTHEBOX——Bank
- IDEA自动生成serialVersionUID
- Robust Real-time LiDAR-inertial Initialization (Real-time Robust LiDAR Inertial Initialization) Paper Learning
- [Kali Security Penetration Testing Practice Course] Chapter 8 Web Penetration
猜你喜欢
flex 的 三个参数:flex-grow、flex-shrink、flex-basis
Arcgis进阶篇(1)——安装Arcgis Enterprise,创建sde库
liunx PS1 settings
The IDEA to automatically generate the serialVersionUID
Example 046: Breaking the Cycle
实例046:打破循环
【Kali安全渗透测试实践教程】第8章 Web渗透
实测办公场景下,国产远程控制软件的表现力如何?(技术解析)
MMDetection框架的anchor_generators.py解析
三极管开关电路参数设计与参数介绍
随机推荐
2022.8.9考试排列变换--1200题解
2022.8.9 Exam Unique Bid Auction--800 Question Solutions
mock模拟,skip,skipif,mark分类
T5: Text-to-Text Transfer Transformer
【红队】ATT&CK - 自启动 - 注册表运行键、启动文件夹
实例047:函数交换变量
Error state based Kalman filter ESKF
【CC3200AI 实验教程5】疯壳·AI语音人脸识别(会议记录仪/人脸打卡机)-定时器
使用注解实现限流
【Image Classification】2022-ResMLP
第三章 搜索与图论(二)
P1564 Worship
Research on IC enterprises
基于误差状态的卡尔曼滤波ESKF
Day16 charles的基本使用
网页挖矿溯源?浏览器浏览历史查看工具Browsinghistoryview
[Kali Security Penetration Testing Practice Tutorial] Chapter 6 Password Attack
vite基础,vite中 `@`符号是不被支持,不用@符号,直接用层级(./,../等)
【Kali安全渗透测试实践教程】第6章 密码攻击
[Kali Security Penetration Testing Practice Course] Chapter 8 Web Penetration