react-router 使用browserHistory时不能刷新,404或 报错Unexpected token <

一、刷新后就报404,应该要怎么改?html

解决:nginx

若是使用nginx服务器,加上try_files配置:
 
      location / {
             ......
             try_files $uri /index.html;
         }

二、使用browserHistory时不能刷新,报错:Uncaught SyntaxError: Unexpected token <服务器

解决:
 
      在index.html中修改 .js 引入路径,使用绝对地址进行引入!
 
      例如:

clipboard.png

使用绝对路径引入:

clipboard.png

相关文章
相关标签/搜索