Description
The default host in the start script is 0.0.0.0
. This differs from the default of webpack-dev-server which is to bind to localhost.
I found this out by reading the output of npm run dev
:
You can now view app in the browser.
Local: http://localhost:3001/
On Your Network: http://192.168.43.210:3001/
Note that the development build is not optimized.
To create a production build, use yarn build.
I hadn't noticed it much before, but I happened to be in a coffee shop working on an API client, so I found it a bit concerning that it was being exposed to the outside. The use case given is for Tools like cloud9. I suggest having them alter their package.json
to "start": "HOST=0.0.0.0 react-scripts start"
or something instead of having the unusual use case made the default.
If nothing else, if the default can be changed, the message shown when running npm run dev
can be simplified. If you have the typical use case of using it for dev only on your machine it's unnecessary, and if you're using ngrok it's a bit redundant.