vue.config.js文件的创建与配置,优化

1.vue.config.js文件简介

vue.config.js文件是可选文件,所以一般vue-cli创建项目的时候是没有这个文件,需要在根目录下手动添加vue.config.js文件,这样@vue/cli-service会自动加载vue.config.js文件。

2.vue.config.js的属性的默认值:

exports.defaults = () => ({
  // project deployment base
  publicPath: '/',

  // where to output built files
  outputDir: 'dist',

  // where to put static assets (js/css/img/font/...)
  assetsDir: '',

  // filename for index.html (relative to outputDir)
  indexPath: 'index.html',

  // whether filename will contain hash part
  filenameHashing: true,

  // boolean, use full build?
  runtimeCompiler: false,

  // deps to transpile
  transpileDependencies: [
    /* string or regex */
  ],

  // sourceMap for production build?
  productionSourceMap: !process.env.VUE_CLI_TEST,

  // use thread-loader for babel & TS in production build
  // enabled by default if the machine has more than 1 cores
  parallel: hasMultipleCores(),

  // multi-page config
  pages: undefined,

  // 
                    
                    

你可能感兴趣的:(vue,vue.js)