路由使用的是browserRouter
打包前:
在devServer能正常访问,url: http://localhost:9104/list
"/list"为路由地址
打包后:
将打包文件放在nginx服务器上,通过80端口能够请求到html及main.js,但是无论怎么拼接路由,都访问不了
url:http://localhost/index.html ; 这个地址能够请求到打包出的index.html,及main.js
url:http://localhost/index.html/list ;504 gateway time-out (nginx 提示)
url:http://localhost/index.html#list ;空白
路由配置:
...
import { Switch, BrowserRouter as Router, Route, Link } from "react-router-dom";
...
render(
<Provider store={store}》
<Router 》
<div》
<Route path="/abc" component={Test}/》
<Route path="/list" component={List}/》
</div》
</Router》
</Provider》,
document.getElementById("root")
);
求助~~~
请问webpack.conf.js需要配置还是Router设置或者其他地方可能有问题,求大神指导