vue打包部署,解决更新版本清理缓存问题

news/2024/7/10 3:04:41 标签: vue, 缓存, javascript, vueConfig, webpack

参考来自:https://blog.csdn.net/lzb348110175/article/details/114142229

一、根目录index.html

在head标签中,加入下面的代码

javascript"><meta http-equiv="pragram" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">

vueconfigjs_moduleexports_12">二、配置vue.config.js (module.exports里)

动态生成文件名

javascript">//顶部设置变量 
const Timestamp= new Date().getTime()
javascript">configureWebpack: { // js 配置
    output: { // 输出重构  打包编译后的 文件名称
      filename: `static/js/[name].${process.env.VUE_APP_Version}.${Timestamp}.js`,
      chunkFilename: `static/js/[name].${process.env.VUE_APP_Version}.${Timestamp}.js`
    },
  },
  css: { // css 配置
    extract: {
      // 修改打包后css文件名   
      filename: `css/[name].${Timestamp}.css`,
      chunkFilename: `css/[name].${Timestamp}.css`
    }
  },

注:如果在文件中没有以上配置项,添加进去,路径可根据自己项目中的路径调整,主要是文件名部分


http://www.niftyadmin.cn/n/1065182.html

相关文章

Silverlight公网部署OOB模式时自动更新的配置

OOB公网部署时必须加上数字签名才能自动更新&#xff0c;目前查到的方法如下&#xff1a; 1&#xff0c;打开Visual Studio Tools里面的命令提示&#xff0c;然后运行以下命令。 makecert.exe -r -n "CNLINYH" -b 01/01/2009 -e 12/31/2019 -sv c:\Cert\CbipSetupKey…

shell 使用Seq算出1-100的奇数之和

#! /bin/bash echo 计算出1-100的奇数之和 sum0 for i in $( seq 1 2 100) do let "sumi" done echo result$sum[rootlenny Desktop]# ./countjishu.sh 计算出1-100的奇数之和 result2500转载于:https://www.cnblogs.com/leonarcohen/p/6159435.html

Js word格式doc文件下载

一、 下载方式 a) 获取后端传过来的url 静态资源 通过a标签做点击操作 Window.location.href url下载 Window.open(url)下载 b) 文件流下载&#xff08;application/json; application/octet-stream&#xff09; 文件流获取转换blob对象模拟a标签点击下载 二、 下载doc…

gcc Variable-length_array

http://en.wikipedia.org/wiki/Variable-length_array 意味着gcc下,这么写是可以的: #include <stdio.h> int main() {int buff_size 1234; char char_buff[buff_size]; printf("size:%d", sizeof(char_buff)); return 0;} VS2008下是不行的, 仍需要: const …

avue监听下拉列表变化实时更新数据

应用点&#xff1a;监听下拉列表数据变化&#xff0c;自动生成其他数据&#xff0c;同时适用于子组件初始化 watch:{sourceTermForm.$type:{//val 为当前下拉列表选中数据&#xff0c;同时更新数据handler(val){if(val! && val!undefined && val!null){this.so…

JavaScript全面学习(函数)

1.定义函数的两种方法&#xff1a; function abs(x) {if (x > 0) {return x;} else {return -x;} } 或者 var abs function (x) {if (x > 0) {return x;} else {return -x;} }; //记得要加分号&#xff0c;因为这是赋值abs变量 2.调用函数 abs(10, blablabla); // 返回…

前台获取服务器端的值

var lists <% strdatesjObject%>;var Allows <% strallowjObject%>;var key "<% p %>";

Emacs Org Mode 设置

Emacs23.3自带的Org版本为6.33官方的版本已经更新到7.x在Ubuntu中,安装完成Emacs之后,可以使用apt-get install org-mode来更新Org;;------------------- Org --------------------;;设置缺省模式为org-mode&#xff0c;并非fundamental-mode(setq default-major-mode org-mode…