you can do this by run npm run build --mode production --dest ./dist/production
or
You can achieve this by edit package.json file and add the below run script.
when you add -- mode and --dest in the build command this will pass it to the build script and will look for the mentioned env
"build-production": "vue-cli-service build --mode production --dest ./dist/production",
This will take the environment variables from a file called .env.production if not found will search on file called .env
And will export the build in a dir called dist/production and you can change this from --dest part
Then you should run
npm run build-production
This will will run for production and you can make a second scrip and change to development to read from .env.development
Something like
"build-development": "vue-cli-service build --mode development --dest ./dist/development",