Home > Article > Web Front-end > webpack-dev-server remote access configuration tutorial
This article mainly shares with you a webpack-dev-server remote access configuration method. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor to take a look, I hope it can help everyone.
The webpack-dev-server configured in the package.json file below is in development mode and can be accessed using http://localhost:8080 or http://127.0.0.1:8080
"scripts": { "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot", "build": "rimraf dist && cross-env NODE_ENV=production webpack --progress --hide-modules" },
When remote access is required, modifications need to be made in package.json
"scripts": { "dev": "webpack-dev-server --host 10.30.1.102 --devtool eval --progress --colors --hot --content-base build", "build": "rimraf dist && cross-env NODE_ENV=production webpack --progress --hide-modules" },
At this time, you can access it through http://192.168.10.8:8080 or http://127.0.0.1:8080, but http://localhost:8080 cannot be accessed.
Related recommendations:
webpack-dev-server uses http-proxy to solve cross-domain problems in detail
The above is the detailed content of webpack-dev-server remote access configuration tutorial. For more information, please follow other related articles on the PHP Chinese website!