The browser configuration is automatically opened after the vue3 ts project is started

Method 1: Configure in the package.json file, add --open, restart the project


"scripts": {
    
    
    "serve": "vue-cli-service serve --open",//加上 --open,重启项目即可
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },

Method 2: Add open: true in the vue.config.js configuration file (Method 1 has a higher priority. If it is set to open: false in vue.config.js, the command to open the browser will still be executed)

module.exports = {
    
    
  outputDir: 'dist',
  publicPath: './',
  devServer: {
    
    
    open: true    // 设置完,重新项目
  },
  // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建
  productionSourceMap: false,
  chainWebpack: config => {
    
    
    config
      .plugin('html')
      .tap(args => {
    
    
        args[0].title = '测试'
        return args
      })
  }
}

Guess you like

Origin blog.csdn.net/weixin_45108907/article/details/115065607