Home  >  Article  >  Web Front-end  >  webpack-dev-server remote access configuration tutorial

webpack-dev-server remote access configuration tutorial

小云云
小云云Original
2018-02-23 09:17:021530browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn