Vue项目配置本地访问地址和IP访问地址
1.在config/index.js配置:
dev: {
host: '0.0.0.0',
}
2.在build/webpack.dev.config.js更改compilationSuccessInfo的message,如下:
compilationSuccessInfo: {
// messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
messages: [
`Your application is running here:`,
`Local: http://localhost:${port}`,
`Network: http://${require('ip').address()}:${port}`,
],
},