Home >Web Front-end >JS Tutorial >How to deal with the vue+webpack+myproject project that cannot be accessed by ip

How to deal with the vue+webpack+myproject project that cannot be accessed by ip

php中世界最好的语言
php中世界最好的语言Original
2018-06-15 14:17:151209browse

This time I will show you how to deal with the vue webpack myproject project whose IP cannot be accessed. What are the precautions when dealing with the vue webpack myproject project whose IP cannot be accessed? The following is a practical case, let's take a look.

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

I believe you have already read the case in this article After mastering the method, please pay attention to other related articles on the php Chinese website for more exciting content!

Recommended reading

How to use webpack vue environment LAN

How to operate nodejs to encrypt passwords

The above is the detailed content of How to deal with the vue+webpack+myproject project that cannot be accessed by ip. 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