Home  >  Article  >  Web Front-end  >  What should I do if the IP cannot be accessed when webpack+myproject builds the project?

What should I do if the IP cannot be accessed when webpack+myproject builds the project?

php中世界最好的语言
php中世界最好的语言Original
2018-05-04 09:27:071618browse

This time I will bring you how to deal with the inaccessible IP when webpack myproject builds the project. What are the things to note?The following is a practical case, let's take a look. one time.

Problem

vue init webpack myproject The project built using localhost or 127.0.0.1 can be accessed normally, but switching to the local ip does not work

Solution

Append the following code to webpack.dev.conf.js

const HOST = process.env.HOST || '0.0.0.0';

Restart

npm run dev

Just reopen it

Believe it After reading the case in this article, you have mastered the method. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

Nodejs summary of password encryption processing methods

How to implement query dynamic parameter passing in vue-router

The above is the detailed content of What should I do if the IP cannot be accessed when webpack+myproject builds the project?. 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