webpack打包预览问题 补充中

199 阅读1分钟

打包后 dist下index.html浏览器打开报错

vue2

微信图片_20220405113137.png

查看index.html代码 引入路径不对

微信图片_20220405113141.png

webpack打包配置output项的publicPath 从'/' 改为'./'即可

微信图片_20220405113957.png

就是在dist/index.html中,修改对js等静态资源引入时的公共路径

vue3

webpack的配置 封装过度了 得去node_modules去找

可以vue.config.js里面直接加publicPath覆盖调

微信图片_20220405130428.png