【发布时间】:2020-06-15 07:15:30
【问题描述】:
我可以使用以下 apache 配置完美访问我的索引页面
<VirtualHost *:443>
ServerName MyReactAppSite
DocumentRoot /var/www/sites/MyReactAppSite/client/build/
</VirtualHost>
在我的 App.js 文件夹中,我有以下代码
<Route exact path="/home" component={Home} />
所以登录后应用路由到http://MyReactAppSite/home
完美搭配 >> npm run start
404 未找到 >> npm run build 后跟 serve -s build
当我查看 /build 文件夹时,没有 /home 文件夹,那么获取 React 应用程序的生产构建的正确方法是什么。我已经阅读了整页 2x https://create-react-app.dev/docs/deployment/ 并且似乎无法弄清楚。
【问题讨论】:
标签: reactjs apache npm create-react-app