vue-h5-template
vue-h5-template copied to clipboard
router 懒加载配置问题
本地调试时路由跳转一切正常。
打包后会出现一个问题:当前路由栈比较深时候,再点击按钮进行页面跳转,会因为无法加载对应的js文件报错,从而导致无法跳转。错误信息如下:
home:1 Uncaught (in promise) ChunkLoadError: Loading chunk chunk-278d49b8 failed. (missing: http://xxx.xxx.com/orderDetail/static/js/chunk-278d49b8.8fc23363.js)
仔细分析路径发现,url中居然插入了跳转前所在页面的路径“orderDetail”。
经过搜索引擎查阅资料排错后,统一修改vue.config.js 中的publicPath为'/',即可解决。