当前位置: 首页 > Web前端 > HTML5

vue 打包到 nginx Uncaught SyntaxError- Unexpected token < 问题解决办法

时间:2023-04-05 20:26:36 HTML5

vue打包成nginxUncaughtSyntaxError:Unexpectedtoken<问题解决将nginx.conf文件添加到location/{try_files$uri$uri//index.html;}就会出现上面的问题。原因是在js文件为404时js文件被强制转换为index.html,无法识别js文件。优化上层配置,将上面{}中的代码改成下面的代码,完美解决rewrite^.+(?