Anyone here got webpack-dev-server to work on Cloud 9?
Hi, since webpack-dev-server has a dependency on node-gyp ( see issue #229 ) we tried using it with cloud 9 which runs an online editor on a Linux machine. The installations of webpack-dev-server on cloud 9 goes smoothly but requests to it were not successful. I suspect it has something to do with a different networking paradigm. All the tutorials I've found on webpack-dev-server show the index.html will have a script tag with the source of the output bundle.js coming from the webpack-dev-server at localhost:8080 which is the default... when you run on your local machine it make sense to access the server via localhost, but when you run the webpack-dev-server on cloud 9 it should be something else. a normal express app could be accessible via their scheme - https:// + your username + / + your workspace name - serving as if you would run localhost, so I tried that scheme and it didn't work, I tried using 0.0.0.0:8080 and it didn't work. I also noticed that c9 runs on https and the webpack-dev-server must assume plain http when communicating with the client via socket.io... In short - I'd appreciate any help from someone who managed to get the webpack-dev-server to run on c9... Thanks Ajar
webpack-dev-server --history-api-fallback --inline --progress --public myproject.c9users.io --host $IP --port $PORT
``` worked for me
Thank you @adleviton ! That worked for me.
Adding this --host $IP --port $PORT --public $C9_HOSTNAME
after this cross-env NODE_ENV=development webpack-dev-server --open --hot
works fine for me with hot reloading.
GET http://0.0.0.0:8080/packs/application.js net::ERR_EMPTY_RESPONSE It works on its own but not with Rails server running.
webpack-dev-server --public your-project.c9users.io --host $IP --port $PORT --hot --inline --
I struggled for so long until trying @x5engine's suggestions.
THANK YOU! I finally got it to work.
If anyone comes across this, I wanted to share my solution because I know how frustrating this can be (for the new AWS Cloud 9):
EDIT (thanks @jakewatton95) { You'll need to add an inbound rule for port 8080 to your EC2 instance:
-
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
-
In the navigation pane, choose Security Groups. Select the security group for your instance.
-
Choose Inbound, Edit, Add Rule.
-
Add 8080, and give it the name "dev-server"
}
Create a script in your package.json:
"dev-server-c9": "webpack-dev-server --host 0.0.0.0 --port 8080"
Then open the terminal in AWS Cloud 9, and run the script:
npm run dev-server-c9
The terminal should output "Project is running at http://0.0.0.0:8080/"
Just click on the address, and choose "open," it will open a new browser window pointing to the page.
@Johnzy916 Solution works, but you need to make sure you're allowing inbound connections on port 8080 from the IP that you are trying to see the page from.
Try below config and make sure to set https: false
devServer: { host: process.env.IP, public : "https://*****.vfs.cloud9.us-east-2.amazonaws.com", https: false, disableHostCheck: true, historyApiFallback: true, port: 8080, },
this is related to the glory days of c9, not the new weird aws c9