vue-cli 项目 设置 splitChunks 后导致页面空白问题

由于chunk-vendors过大,于是想通过设置optimization.splitChunks拆分一下大的js文件,但是设置后导致页面一片空白,配置如下:

控制台警告:

The resource <URL> was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.

点开后有16个类似的警告

the resource http://localhost:8087/npm.vuex.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.

The resource http://localhost:8087/npm.vue.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.

后来看到了这个 https://www.jianshu.com/p/78ca0d36b99d 受到启发,于是我到vue-cli 的文档上找到了这个


将所有警报的chunks都添加上,配置如下

重启!页面正常显示了!!!

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容