zoukankan      html  css  js  c++  java
  • ----vue项目打包之浏览器存在缓存问题----

    在入口文件index.html添加

    <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">

    因浏览器缓存原因导致vue 打包后的文件不能即使更新最新代码。缓存里的内容没有清除。(基本没作用)

    解决办法就是在打包的文件名中添加一个版本号以便浏览器能区分。

    build--webpack .prod.conf.js

    const  Version = new Date().getTime(); //定义一个时间作为版本号。

     output: {
        path: config.build.assetsRoot,
        filename: utils.assetsPath('js/[name].[chunkhash]'+ Version+'.js'),
        chunkFilename: utils.assetsPath('js/[id].[chunkhash]'+Version +'.js')
      }

  • 相关阅读:
    java反编译工具
    Eclipse反编译插件: Jodeclipse与JadClipse
    Apk修改利器:ApkToolkit v2.1
    新浪微博2.5.1 for Android 去广告
    java
    第K顺序统计量
    身份证号码
    pop3
    google
    Exception
  • 原文地址:https://www.cnblogs.com/zjy850984598/p/11154132.html
Copyright © 2011-2022 走看看