Skip to content

npm run build --mode [.env.mode] not working as expected #1528

Closed
@ghost

Description

Version

3.0.0-beta.16

Reproduction link

https://codesandbox.io/s/qlx254n09j

Steps to reproduce

  1. Create .env.staging file in the root
  2. Add key pairs NODE_ENV=production and VUE_APP_ENV=staging in the file
  3. Add script to package.json "staging":"vue-cli-service build --mode staging",
  4. Run npm run build --mode staging
  5. Run npm run staging

What is expected?

Case 1

npm run buid --mode staging

gives a production oriented build with staging variables

Case 2

npm run staging

gives a production oriented build with staging variables

What is actually happening?

Case 1

It gives a production oriented build with production variables

Case 2

It gives a development oriented build with staging variables


I need this to deploy this to Heroku. CD/CI. I'm using postinstall script to build production, dev or staging servers based on the APP_VUE_ENV variable. Please help me. I'm super excited with Vue so far!

Reference:

https://cli.vuejs.org/guide/mode-and-env.html#example-staging-mode
#948
https://forum.vuejs.org/t/how-to-build-production-app-with-varying-config/29708

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions