vue cli3.0 build 打包 的 js 文件添加版本号 解决 js 缓存问题,build报错

image.png

image.png

image.png

image.png
想build添加版本号解决缓存问题,但是webpack报错,有大佬知道这是啥问题吗?谢谢

阅读 1.3k
1 个回答

你是为了解决缓存问题,[chunkhash]本身就是个变量,你加Version的目的也是为了让它成为变量,要做的是清除index.html的缓存即可。nginx增加配置

# 前端html文件
    location / {
        # disable cache html
        add_header Cache-Control 'no-cache, must-revalidate, proxy-revalidate, max-age=0';
        index index.html index.htm;
        try_files $uri /index.html;
    }
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题