Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify a vue-cli vue.config.js location

I have a vue.config.js file in my project's base directory. I'd like to move this next to my other config files in a /config/ folder.

How can I specify the new location of this file for vue-cli?

like image 648
iRyanBell Avatar asked Sep 01 '18 20:09

iRyanBell


People also ask

Is vue and vue CLI the same?

Vue CLI 3 is a complete rewrite of the previous version of the Vue command line interface tool and comes with a set of new features which makes Vue development and the management of Vue projects a lot easier: Out-of-the-box support for Babel, TypeScript, ESLint, PostCSS, PWA, Unit Testing & End-to-end Testing.

What is defineConfig?

defineConfig is a bypass function with type hints, which means you can also omit it if you don't need the autocompletion/typecheck. windi.config.js. export default { /* configurations... */ } You can use the autocompletion from your editor to see possible configuration fields.

Where is webpack config js vue?

The webpack-simple template has the webpack-config. js file directly in root of your project folder. Looks like you are using webpack template. To make changes to the webpack config goto the build folder.


1 Answers

The environment variable VUE_CLI_SERVICE_CONFIG_PATH specifies the absolute path to vue.config.js. Relative paths for this variable fail on macOS (and probably other platforms).

Example on command line:

$ VUE_CLI_SERVICE_CONFIG_PATH=$PWD/config/vue.config.js npm run build

Or in package.json:

{
  "scripts": {
    "build": "VUE_CLI_SERVICE_CONFIG_PATH=$PWD/config/vue.config.js vue-cli-service build"
  }
}
like image 72
tony19 Avatar answered Sep 19 '22 08:09

tony19