node_modules/html-webpack-plugin/index.js
搜索 postProcessHtml

修改代码增加如下:

if (assetTags && assetTags.body && assetTags.body.length) {
                    for (var index = 0; index < assetTags.body.length; index++) {
                        var element = assetTags.body[index];
                        if (element && element.attributes && element.attributes.src === '/app.js')
                            element.attributes.src = '/app.js?now=' + Date.now()
                    }
                }

webpack vue app.js自动注入页面.为app.js增加随机参数
webpack vue app.js自动注入页面.为app.js增加随机参数

这么做是为什么呢?
手机端webview调试,发现手机端对资源做了缓存。导致每次都要app清理缓存才能加载新的js。所以服务端来做这个事情。只要每次重启服务端就好拉。

相关文章:

  • 2021-11-13
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2021-04-03
  • 2021-06-16
  • 2021-10-29
猜你喜欢
  • 2022-02-11
  • 2022-12-23
  • 2021-09-25
  • 2022-12-23
  • 2021-04-04
  • 2021-08-21
  • 2021-12-04
相关资源
相似解决方案