Open the running aplicaction (React, Webpack)

reactjs

#1

I’ve compiled my app (a react-toolbox-example) with Webpack, and it says:

pmiranda:~/workspace (master) $ npm start

react-toolbox-example@0.12.0 start /home/ubuntu/workspace
cross-env NODE_ENV=development node_modules/.bin/webpack-dev-server --colors --config webpack.config.js

Project is running at http://localhost:8080/

When I open http://localhost:8080/ it sends me to my workspace as:

http://react-toolbox-example-pmiranda.c9users.io:8080/

But the page says that there’s “no application seems to be running here!”

How can I see my app? I’ve tried using different ports but I got the same always.


#2

That’s because you need to listen on$IP, not localhost. Localhost is only visible internally, whereas​ $IP usually points towards 0.0.0.0, which is visible to the outside and allows you to access your workspace using the preview URL.


#3

Thanks, and where I have to set that?. I’ve trying to follow this: https://github.com/webpack/webpack-dev-server/issues/230

EDIT: yay! It’s running now! (with js errors but that’s another story with hot module)

I compile using this:

webpack-dev-server --host $IP --port $PORT --hot --inline

EDIT2: I got it, with hot reloader:

webpack-dev-server --port $PORT --host $IP --content-base build/


#4

I’ve hit this wall several times in slightly different contexts, and again I’m here looking up the answer .

I need to really understand the solution, or the solution should be easier to find. Or both.


#5

I am in the same position right now.

Entering webpack-dev-server --port $PORT --host $IP --content-base build/ on the shell returns:

bash: webpack-dev-server: command not found

How do I change the host and port for react app to be visible on the preview url?


#6

I have sort of the same issue (cant figure how to change port, ip)

If you think you can help an answer here will be much appreciated!

ty