[Vuejs]-How do I stop VueJS S3 Deploy from re-uploading static files?

0👍

It turned out being the dist folder itself that gets re-generated entirely when building, and that confuses AWS SYNC functionality, making it upload everything again.

I ended up splitting the deploy process into 2 different NPM tasks, one of them uploading the assets folder and the other uploading the rest. Here are the final commands:

1) Deploy fonts an images

aws s3 sync --acl public-read dist/fonts s3://bucket/fonts
aws s3 sync --acl public-read dist/img s3://bucket/img

2) Deploy the rest of the project except my assets

aws s3 sync --acl public-read --exclude 'fonts/*' --exclude 'img/*' dist s3://bucket

It’s worth noting that both “img” and “fonts” folders are generated by Vue CLI itself and contain all of the project images and fonts respectively.

Leave a comment