Vue-cli3.x在开发环境中(router采用 history模式)出现Failed to resolve async component default: Error: Loading chunk {/d} failed.或者Uncaught SyntaxError: Unexpected token <错误

2023-05-10,,

使用Vue-cli3.x开发环境中(router采用 history模式)出现Failed to resolve async component default: Error: Loading chunk {/d} failed.或者Uncaught SyntaxError: Unexpected token <错误

错误截图

解决方案

修改webpack的配置,

在vue.config.js文件中修改publicPath为'/'即解决问题

module.exports = {
publicPath: '/', // <----这里就是会修改webpack的outPath.publicPath
}

Vue-cli3.x在开发环境中(router采用 history模式)出现Failed to resolve async component default: Error: Loading chunk {/d} failed.或者Uncaught SyntaxError: Unexpected token <错误的相关教程结束。

《Vue-cli3.x在开发环境中(router采用 history模式)出现Failed to resolve async component default: Error: Loading chunk {/d} failed.或者Uncaught SyntaxError: Unexpected token <错误.doc》

下载本文的Word格式文档,以方便收藏与打印。