在没有端口的情况下启动 ReactJS 应用程序

Ven*_*omu 6 bundle npm reactjs react-router react-native

我正在使用 create-react-app 开发 ReactJS 应用程序。

npm start 和 npm run 构建应用程序工作正常,应用程序在端口号(如 4000 或 Pushstate-server 构建在端口 9000 中运行)运行,问题是我需要在公共 url 中运行没有端口号的构建应用程序像http://sample/home/,当我直接浏览 build/index.html 时,它正确显示主页,但路由不像端口中那样工作,所有 css 和资产都显示未找到。

小智 2

将端口更改为80。

这是 HTTP 请求的默认值,因此,当您尝试访问时,
www.google.com
实际上您正在访问
www.google.com:80