When using the vue-webpack-boilerplate, you will have only a production build by default (besides dev and test setups). My team often has at least another environment we call "staging" where the client can test new features before we move them to production. Oftentimes, these environments will have env-specific config values, like a different API URL.
With the changes outlined below, you can create a separate config per environment. This assumes you've created a Vue.js project with vue-webpack-boilerplate.
- Apply the changes to the corresponding files in your project as outlined below
- Now, when you run
npm run build stagingit will build your project with the config values specific to your staging environment. You can easily add any number of other environments and build them the same way.
npm run buildor
npm run build productionwill still build your production environment.