5.x 版本 vue-cli 解决默认自动打开浏览器0.0.0.0:8080
vue-cli 5.x 版本 使用--open 时,默认打开浏览器,会出现0.0.0.0:8080 ,解决办法:
在vue.config.js文件新增:
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
devServer: {
open: true,
host: 'localhost',
port: 8080
}
})
再次启动项目,浏览器自动打开http://localhost:8080!

浙公网安备 33010602011771号