配置Vue项目调试时的network
Networkhttp//${require('ip').address()}${port}`,
vue3找到build文件夹下的webpack.dev.conf.js文件,在这个文件里有一个compilationSuccessInfo的messages属性(通常写在最后面的)。往里面添加一条:
// Add FriendlyErrorsPlugin
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
compilationSuccessInfo: {
// messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
// 修改启动后终端显示localhost和network访问地址
messages: [
`App runing at: `,
`Local: http://localhost:${port}`,
`Network: http://${require('ip').address()}:${port}`,
],
},
onErrors: config.dev.notifyOnErrors
? utils.createNotifierCallback()
: undefined
}))
重新npm run dev即可
更多推荐
所有评论(0)