Open AlfredOdling opened 7 years ago
npm run dist
bundles it, and you should be able to serve it with npm run serve:dist
.
Also please post the error messages if possible.
But the server doesn´t get the env.process.PORT variable set. Is that outside of the scope of the implemented server, or can I use that server for dist?
IMO there are two answers to this question.
Setting the port through an ENV var:
Setting the port is a planned feature that I hope to implement soon. You could subscribe to https://github.com/react-webpack-generators/react-webpack-template/issues/68 (and also +1 it if you feel it would be helpful).
Using the server for running in production:
Besides the port issue, npm run serve:dist
still only uses the webpack-dev-server
to serve the project. This is helpful for testing the created code bundle, but it is not suitable as a production server.
Okey, as a tip for improvement I would strongly suggest putting this info about deployment in the documents!
@AlfredOdling that's a good suggestion, I have added an issue for that (#311) and hope to update it along with the next release.
Im trying to deploy my app and been trying so hard to do it. I dont get it, it should pretty straightforward to do this right? How do you deploy to heroku? Im telling heroku to run: "npm run dist && npm run start". Please check my question on stackoverflow: http://stackoverflow.com/questions/40637447/cant-resolve-module-babel-when-running-dist