Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cotyembry/e4cf7a7a23700331f04c8a29379f529c to your computer and use it in GitHub Desktop.
Save cotyembry/e4cf7a7a23700331f04c8a29379f529c to your computer and use it in GitHub Desktop.

With a webpack-dev-server running on localhost on a computer you can connect to this content on another computer through the LAN (Local Area Network) using the wifi or even an Ethernet cable I suppose.

To do this when you start the dev server you have to specify some things (I did this in my package.json file and will start it using the npm run scripts feature)

"start": "webpack-dev-server --inline --port 8080 --host 192.168.0.12 --content-base ."

To know which port you want to set it up for you can do the following on Windows (you'll have to google 'how to find my ip add ress Linux or unix' for the command to get that information - sorry)

ipconfig

Scroll up to the IPv4 part that is under the LAN details (I think - assuming both computers are going to be connected to the same network, in my case both computers were connected to the same router that shared the wifi)

Under my IPv4 part I saw

192.168.0.12

And the port number I specified just to be more specific in what I was doing to route through the 8080 port. That seems to be a webpack norm so I follow it as well..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment