vue-cli-plugin-s3-deploy
vue-cli-plugin-s3-deploy copied to clipboard
Options are not overridden in production mode
I set an environment variable in .env.production file:
VUE_APP_S3D_BUCKET=production-bucket-name
And deployed my app with this command:
npm run build --mode production && vue-cli-service s3-deploy
I checked that the NODE_ENV is set to production correctly, so I expected that the new s3 bucket will be created with name production-bucket-name, but it was development-bucket-name as written in vue.config.js file:
module.exports = {
pluginOptions: {
s3Deploy: {
registry: undefined,
awsProfile: 'default',
region: 'ap-northeast-2',
bucket: 'development-bucket-name',
createBucket: true,
staticHosting: true,
staticIndexPage: 'index.html',
staticErrorPage: 'index.html',
assetPath: 'dist',
assetMatch: '**',
deployPath: '/',
acl: 'public-read',
pwa: false,
enableCloudfront: false,
uploadConcurrency: 5,
pluginVersion: '4.0.0-rc2',
overrideEndpoint: false
}
}
}
What am I missing here?
Try adding --mode production to the s3deploy command
Have same issue, adding --mode production to s3deploy command didnt help
Got the same issues here that I solve.
When we build we tell the mecanism to look for production variables, yarn build --mode production.
If the build have the good variable, the deploy also need to be inform where to get the variable so we need to specify the mode in yarn deploy --mode production.
Also, My app was with vue-cli, if I was using npm the commande would be this one :
npm run build -- --mode=production and npm run deploy -- --mode=production if I want the params to be pass to vue-cli.
Hope it will help
Faced same issue, specifying the mode worked. This should be mentioned in the docs I believe.
Faced same issue, specifying the mode worked. This should be mentioned in the docs I believe.
Good idea :)