Just a reminder and a TIL about customize the development setup of a Vue app with the CLI.
If you need to create a new custom Mode (other than ‘staging’, ‘test’ and ‘production’), here the tip:
- create a new
.env.mymodefile (where.mymodeis the name of your mode) - write in it
NODE_ENV=mymode - add in
package.jsona new run in “scripts” likevue-cli-service serve --mode mymode - Run it with the new command name (such as
npm run mymode) - Use anywhere in your code both the injected env variables as well as the
process.envvariable such as:
if (process.env.NODE_ENV === 'mymode') {
console.log("another mode!")
}
Tip mainly from here.
Spotted a typo or (likely) a grammar error? Send a pull request.