Home > Web Front-end > JS Tutorial > How to set remote mode for webpack-dev-server

How to set remote mode for webpack-dev-server

php中世界最好的语言
Release: 2018-03-17 14:40:32
Original
1754 people have browsed it

This time I will show you how to set up remote mode for webpack-dev-server. What are the precautions for setting up remote mode for webpack-dev-server? What are the practical cases below? Let’s take a look. The webpack-dev-server configured in the package.json

file below is in development mode, which can be done using http://localhost:8080 or http://127.0.0.1:8080 Access

"scripts": { 
  "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot", 
  "build": "rimraf dist && cross-env NODE_ENV=production webpack --progress --hide-modules" 
 },
Copy after login
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" 
 },
Copy after login
At this time, you can use http://192.168.10.8:8080 or http://127.0.0.1:8080 can be accessed in this form, but http://localhost:8080 cannot be accessed. I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to call parent component in ES6 child component
plotly. How to use js drawing library

The above is the detailed content of How to set remote mode for webpack-dev-server. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template