今天用vue3配置嵌套路由时,发现刷新页面后,页面变为空白,打开控制台发现报错:
Uncaught SyntaxError: Unexpected token '<'
解决方法:
修改vue.config.js文件:
publicPath:"/",
注意不是:
登录后复制
publicPath:"./",
总结
hash模式时在不确定二级目录名称的情况下建议使用""代表相对路径或者"/二级目录/"
history模式默认使用"/"或者"/二级目录/",记住只有hash时publicPath可以为空!!!
- SyntaxError Unexpected Uncaught 页面 tokensyntaxerror unexpected uncaught页面 syntaxerror unexpected uncaught invalid syntaxerror unexpected jconstant uncaught syntaxerror unexpected uncaught情况 syntaxerror unexpected token vite tagoffsetsmap syntaxerror unexpected token originalprompt syntaxerror identifier uncaught codepoint syntaxerror unexpected amp my_customer_index syntaxerror unexpected identifier syntaxerror staticrende unexpected expected