react-webpack-generators / generator-react-webpack

Yeoman generator for ReactJS and Webpack
http://newtriks.com/2013/12/31/automating-react-with-yeoman-and-grunt/
MIT License
2.88k stars 355 forks source link

Cant resolve module 'babel' when running dist #301

Open AlfredOdling opened 7 years ago

AlfredOdling commented 7 years ago

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

stylesuxx commented 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.

AlfredOdling commented 7 years ago

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?

sthzg commented 7 years ago

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.

AlfredOdling commented 7 years ago

Okey, as a tip for improvement I would strongly suggest putting this info about deployment in the documents!

sthzg commented 7 years ago

@AlfredOdling that's a good suggestion, I have added an issue for that (#311) and hope to update it along with the next release.