From 2ab93e797008aee9e36dfb8cc2015c8a9354dd6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20L=C3=BCnborg?= Date: Thu, 13 Dec 2018 14:46:50 +0100 Subject: [PATCH] docs: add tip about detecting modern mode (#3108) [ci skip] * Add tip abouit detecting modern mode close #2921 * add note about postcss * docs: fix typo and format [ci skip] --- docs/guide/browser-compatibility.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/guide/browser-compatibility.md b/docs/guide/browser-compatibility.md index 409257364..3f605d3d6 100644 --- a/docs/guide/browser-compatibility.md +++ b/docs/guide/browser-compatibility.md @@ -78,6 +78,17 @@ Content-Security-Policy: script-src 'self' 'sha256-4RS22DYeB7U14dra4KcQYxmwt5HkO ``` ::: +::: tip Detecting the Current Mode in Config +Sometimes you may need to change the webpack config only for the legacy build, or only for the modern build. + +Vue CLI uses two environment variables to communicate this: + +* `VUE_CLI_MODERN_MODE`: The build was started with the `--modern` flag +* `VUE_CLI_MODERN_BUILD`: when true, the current config is for the modern build. Otherwise it's for the legacy build. + +**Important:** These variables are only accessible when/after `chainWebpack()` and `configureWebpack()` functions are evaluated, (so not directly in the `vue.config.js` module's root scope). That means it's also available in the postcss config file. +::: + [autoprefixer]: https://github.com/postcss/autoprefixer [babel-preset-env]: https://new.babeljs.io/docs/en/next/babel-preset-env.html [babel-preset-app]: https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app