在过去,我只使用github的GH-Pages上传我的前端应用程序作为静态版本 . 这是我的第一个React应用程序,它连接到我上传并在Heroku上运行的后端API .
我使用Create-React-App来构建这个应用程序 . 当我命令npm run build ... Webpack构建我的es5版本的代码,以便浏览器可以读取它 . 所以我的问题是,这是我第一次在heroku上传一个前端应用程序,我该怎么做我的反应文件?
谢谢
有一个buildpack,允许你部署到heroku而无需配置!请参阅Mars Hall关于此主题的博客文章https://blog.heroku.com/deploying-react-with-zero-configuration
在博客上,您将找到有关将新的create-react-app部署到heroku的说明,但是要为预先存在的项目执行此操作...
cd 到终端的项目文件夹并输入以下内容
cd
git init heroku create YOURPROJECTNAME --buildpack https:/github.com/mars/create-react-app-buildpack.git // (creates the heroku project with the create-react-app buildpack specified) git add . git commit -m "YOUR COMMENTS" git push heroku master heroku open
1 回答
有一个buildpack,允许你部署到heroku而无需配置!请参阅Mars Hall关于此主题的博客文章https://blog.heroku.com/deploying-react-with-zero-configuration
在博客上,您将找到有关将新的create-react-app部署到heroku的说明,但是要为预先存在的项目执行此操作...
cd
到终端的项目文件夹并输入以下内容