--- sidebar: auto --- # Configuration Reference ## Global CLI Config Some global configurations for `@vue/cli`, such as your preferred package manager and your locally saved presets, are stored in a JSON file named `.vuerc` in your home directory. You can edit this file directly with your editor of choice to change the saved options. You can also use the `vue config` command to inspect or modify the global CLI config. ## Target Browsers See the [Browser Compatibility](../guide/browser-compatibility.md#browserslist) section in guide. ## vue.config.js `vue.config.js` is an optional config file that will be automatically loaded by `@vue/cli-service` if it's present in your project root (next to `package.json`). You can also use the `vue` field in `package.json`, but do note in that case you will be limited to JSON-compatible values only. The file should export an object containing options: ``` js // vue.config.js module.exports = { // options... } ``` ### baseUrl - Type: `string` - Default: `'/'` The base URL your application will be deployed at. By default Vue CLI assumes your app will be deployed at the root of a domain, e.g. `https://www.my-app.com/`. If your app is deployed at a sub-path, you will need to specify that sub-path using this option. For example, if your app is deployed at `https://www.foobar.com/my-app/`, set `baseUrl` to `'/my-app/'`. Setting this value correctly is necessary for your static assets to be loaded properly in production. This value is also respected during development. If you want your dev server to be served at root instead, you can use a conditional value: ``` js module.exports = { baseUrl: process.env.NODE_ENV === 'production' ? '/production-sub-path/' : '/' } ``` The value can also be set to an empty string (`''`) so that all assets are linked using relative paths, so that the bundle can be used in a file system based environment like a Cordova hybrid app. **Note that this will force the generated CSS files to always be placed at the root of the output directory to ensure urls in your CSS work correctly.** ::: tip Always use `baseUrl` instead of modifying webpack `output.publicPath`. ::: ### outputDir - Type: `string` - Default: `'dist'` The directory where the production build files will be generated in when running `vue-cli-service build`. Note the target directory will be removed before building (this behavior can be disabled by passing `--no-clean` when building). ::: tip Always use `outputDir` instead of modifying webpack `output.path`. ::: ### assetsDir - Type: `string` - Default: `''` A directory (relative to `outputDir`) to nest generated static assets (js, css, img, fonts) under. ::: tip `assetsDir` is ignored when overwriting the filename or chunkFilename from the generated assets. ::: ### indexPath - Type: `string` - Default: `'index.html'` Specify the output path for the generated `index.html` (relative to `outputDir`). Can also be an absolute path. ### filenameHashing - Type: `boolean` - Default: `true` By default, generated static assets contains hashes in their filenames for better caching control. However, this requires the index HTML to be auto-generated by Vue CLI. If you cannot make use of the index HTML generated by Vue CLI, you can disable filename hashing by setting this option to `false`. ### pages - Type: `Object` - Default: `undefined` Build the app in multi-page mode. Each "page" should have a corresponding JavaScript entry file. The value should be an object where the key is the name of the entry, and the value is either: - An object that specifies its `entry`, `template`, `filename`, `title` and `chunks` (all optional except `entry`); - Or a string specifying its `entry`. ``` js module.exports = { pages: { index: { // entry for the page entry: 'src/index/main.js', // the source template template: 'public/index.html', // output as dist/index.html filename: 'index.html', // when using title option, // template title tag needs to be <%= htmlWebpackPlugin.options.title %> title: 'Index Page', // chunks to include on this page, by default includes // extracted common chunks and vendor chunks. chunks: ['chunk-vendors', 'chunk-common', 'index'] }, // when using the entry-only string format, // template is inferred to be `public/subpage.html` // and falls back to `public/index.html` if not found. // Output filename is inferred to be `subpage.html`. subpage: 'src/subpage/main.js' } } ``` ::: tip When building in multi-page mode, the webpack config will contain different plugins (there will be multiple instances of `html-webpack-plugin` and `preload-webpack-plugin`). Make sure to run `vue inspect` if you are trying to modify the options for those plugins. ::: ### lintOnSave - Type: `boolean | 'error'` - Default: `true` Whether to perform lint-on-save during development using [eslint-loader](https://github.com/webpack-contrib/eslint-loader). This value is respected only when [`@vue/cli-plugin-eslint`](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint) is installed. When set to `true`, eslint-loader will only emit warnings during webpack's compilation process in order not to break the flow during development. If you want it to emit errors instead (i.e. when building for production), set it like this: `lintOnSave: 'error'`. ### runtimeCompiler - Type: `boolean` - Default: `false` Whether to use the build of Vue core that includes the runtime compiler. Setting it to `true` will allow you to use the `template` option in Vue components, but will incur around an extra 10kb payload for your app. See also: [Runtime + Compiler vs. Runtime only](https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only). ### transpileDependencies - Type: `Array` - Default: `[]` By default `babel-loader` ignores all files inside `node_modules`. If you want to explicitly transpile a dependency with Babel, you can list it in this option. ### productionSourceMap - Type: `boolean` - Default: `true` Setting this to `false` can speed up production builds if you don't need source maps for production. ### corsUseCredentials - Type: `boolean` - Default: `false` In modern mode, the generated HTML will include `