vue.config.js常用配置项

738 阅读1分钟
	// vue.config.js
    // baseUrl Vue CLI3.3起已弃用
    publicPath:'/', //部署应用包时的基本URL
    outputDir:'dist', // 构建/打包目录
    assetsDir:'', // 放置生成的静态资源目录(相对于outputDir)
    indexPath:'index.html', // 指定index.html的输出路径(相对于outputDir,也可以是绝对路径)
    lintOnSave:'default', // 默认开启eslint检查可使用boolean值关闭和开启
    runtimeCompiler:false, // 是否使用包含运行时编译器的Vue构建版本
    procuctionSourceMap:true, // 生产环境source map可设置false以加速生产环境构建
    configureWebpack:{}||function(){}, // 合并或修改webpack配置
    chainWebpack:function(){}, // 对webpack内部配置进行更细粒度的修改
    // devServer:{}, // 所有webpack-dev-server选项都支持
    devServer:{
    	// proxy:'http://localhost:9090', // 跨域请求代理
      proxy:{
        '/api':{
          target:'<url>',
          ws:true,
          changeOrigin:true // 跨域
        },
        '/foo':{
          target:'<other_url>'
        }
      }
    }