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

I was having the same problem, I figured out my problem was from using a beta version (3.0.0-beta.9) of @vue/cli-service so changing it to the rc version (3.0.0-rc.3) worked. So in my package.json under devDependencies I changed it to "@vue/cli-service": "^3.0.0-rc.3"


You need to use the following command

npm run build -- --mode staging

All arguments before -- are considered npm arguments and arguments after -- are passed to vue-cli-service

Tags:

Vue.Js

Vuejs2