Update vue-cli mode documentation to show a mode other than production or development
See original GitHub issueWhat problem does this feature solve?
Increases comprehension on what the --mode feature can be used for and how it might be used, specifically that you can override the NODE_ENV variable to produce a production build with alternate config (ie. staging)
Refer to https://forum.vuejs.org/t/how-to-build-production-app-with-varying-config/29708/3
What does the proposed API look like?
.env
VUE_APP_TITLE=My App
.env.staging
NODE_ENV=production
VUE_APP_TITLE=My App (staging)
vue-cli-service build
- builds a production app using .env then .env.production (or .env.production.local)
vue-cli-service build --mode staging
- builds a production app using .env then .env.staging (or .env.staging.local)
In both cases, the app is built as a production app because of the NODE_ENV, but in the staging equivalent the process.env.VUE_APP_TITLE variable is overrided
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Modes and Environment Variables - Vue CLI
Mode is an important concept in Vue CLI projects. ... will determine the primary mode your app is running in - development, production...
Read more >Custom Build Modes with Vue CLI 3 | Rangle.io
In this post, we'll go over how to add and configure a custom build mode other than the default production, development and test...
Read more >Using Environment Variables with Vue.js - Stack Overflow
Vue.js with Webpack. If you use vue cli with the Webpack template (default config), you can create and add your environment variables to...
Read more >Building with custom mode will lose all built-in config. #4699
"buildtest": "vue-cli-service build --mode test" ... set NODE_ENV to other values than the commonly used production , development and test .
Read more >How To Use Environment Variables in Vue.js - DigitalOcean
With Vue.js, it is possible to use environment variables through files with the .env file extension. These files are responsible for storing ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jnarowski See the start of this thread, just add a ‘.env.staging’ file and add the NODE_ENV=production as the first line and then do
vue-cli-service build --mode staging
Hmm, I’m wondering if the example of setting the BASE_URL on this page should also be updated:
https://cli.vuejs.org/config/#baseurl
Because if the only way to trigger a slimmed down “production” build is by setting the NODE_ENV=production, it makes relying on the NODE_ENV to inform the app about which environment you’re in useless.
Instead, it seems like the example here should instead rely on using the modes, and setting the different base_urls in an environment variable in the corresponding .env.[mode] file and using that variable to set the
baseUrl:
value: