Skip to content

Conversation

githoniel
Copy link
Contributor

@githoniel githoniel commented Dec 21, 2020

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:

We now support customizing the path to the configuration file via process.env.VUE_CLI_SERVICE_CONFIG_PATH, but this variable will be executed before the plugin apply. It means we can not set configuration file path in plugin.

I have developed a plugin cli-plugin-doc that registers the dev:doc command for starting project's documentation development. This cli-plugin-doc plugin requires the vue-cli build process, but needs to read ./docs/vue.config.js to implement the independent webpack build parameters compared with vue-cli-service serve.

With the current mechanism, neither defaultModes nor .env can meet the need.

Before:

module.exports.defaultModes = {
  'test:e2e': 'production'
}

process.env.NODE_ENV will be production when running vue-cli-service test:e2e

after:

module.exports.defaultModes = {
  'test:e2e':  ['production', {
     'VUE_CLI_SERVICE_CONFIG_PATH': './docs/vue.config.js'
   }]
}

In addition to the setting process.env.NODE_ENV when running vue-cli-service test:e2e , environment variables will be set process.env.VUE_CLI_SERVICE_CONFIG_PATH = './docs/vue.config.js'

environment variables is optional, so this does not break current plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants