What methods can I use to prevent VueJS S3 Deploy from repeatedly uploading static files?

In the process of developing a new VueJS application with Vue's CLI tool, I have been including several images and fonts in the "assets" directory within "src". However, each time I run the vue-cli-service s3-deploy command, it ends up re-uploading all the assets even if they haven't changed.

Is there a way to make sure that static assets are skipped during deployment to S3?

Answer №1

During the build process, I discovered that the dist folder is completely regenerated each time, causing confusion with AWS SYNC and resulting in re-uploading everything.

To resolve this issue, I decided to split the deployment into two separate NPM tasks. One task uploads the assets folder while the other handles the rest of the project. Below are the final commands:

1) Upload fonts and 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 remaining project files excluding assets

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

It's important to note that both the "img" and "fonts" folders are auto-generated by Vue CLI and contain all project images and fonts respectively.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Upon sending a POST request to http://localhost:5000/getData, a 404 error (Not Found) was encountered while using axios

As a newcomer to react and node.js, I have set up a fake server running on port 5000 with an API (http://localhost:5000/getData) that contains a hardcoded array of objects. My goal is to add a new object to this API from my react frontend running on port 3 ...

What is the best way to deal with empty arrays during serialization of modified form elements only?

Managing a form with numerous multi-select fields can be challenging, especially when dealing with paged ajax. With each select having a unique ID and named accordingly as values[foobar1][], values[foobar2][], values[foobar3][], and so on, it's crucia ...

Field must have a base type specified to proceed

Currently, I am in the process of developing a discord.js bot. The structure I have set up involves a folder that contains all the commands, and when a command is called, index.js directs it to the appropriate file. However, when attempting to run the bot, ...

Can you help me find the missing loader reference in my webpack configuration?

Encountering a particular issue with my webpack configuration while working on a new project. For some reason, my react code is not being bundled correctly and I keep getting the following error message: ERROR in ./index.jsx 47:6 Module parse failed: Unex ...

Parcel-Bundler is unable to resolve critical security issues

I recently followed a tutorial by Kevin Powell on SASS and Parcel through YouTube. I was able to successfully set up the SASS part and get the Parcel bundler working smoothly on one project, so everything seemed to be going well at that point. However, to ...

How can TypeScript and MobX work together using Set()?

I'm encountering errors while trying to implement Set() in my Grocery Shopping app using MobX with TypeScript. I have a simple setup with defined types in types.ts: types.ts export type Item = { name: string; instock: number; price: number; }; ...

The error message "Error: 'x' is not a defined function or its output is not iterable"

While experimenting, I accidentally discovered that the following code snippet causes an error in V8 (Chrome, Node.js, etc): for (let val of Symbol()) { /*...*/ } TypeError: Symbol is not a function or its return value is not iterable I also found out ...

Trouble arises when attempting to transpile a Node.js application using gulp-babel's ignore feature

I've set up a gulp task to transpile my Node.js app: gulp.task('babel', function() { return gulp.src('./**/*.js') .pipe(babel({ ignore: [ './gulpfile.js', './ ...

What is the best approach for establishing an asynchronous connection to a MongoDB database?

Managing a MongoDB database using JavaScript and Node.js with Mongoose, I needed to retrieve an array containing the names of all collections in the database. Taking this into consideration, I implemented the following code snippet. let connection = mongoo ...

Load pages seamlessly with AJAX

I'm facing a challenge: Is there a way to dynamically refresh a <div> element on a webpage using AJAX, without displaying loading bars and without causing the existing content to disappear while new content is being loaded? I would like the pr ...

What's the best way to display a bootstrap modal window popup without redirecting to a new page?

I am having trouble implementing a modal window that will display validation errors to the user when they submit a form. Currently, the window is opening as a new view instead of overlapping the existing form's view. How can I adjust my code so that t ...

Firebase is not updating the number

Having just started with Firebase, I have been following all the guidelines for web Firebase auth. I have successfully managed to login, log out, and update all data except for the phone number. Despite receiving a success message in the console, my phone ...

The sendFile function fails to transmit any data

Currently working on integrating the mailChimp API into my project, but facing an issue with the resFile code that handles sending the success response. The current code snippet: async function run(){ try { const res = await mailch ...

Utilizing Typescript to troubleshoot linting issues

After running the TypeScript linter, I received the following error message: Do not use Function as a type. The Function type accepts any function-like value, providing no type safety when calling the function. This lack of specificity can lead to common ...

Expanding Text Box

My goal is to create a textarea that automatically adjusts its size as the user types or pastes long text into it. This is my current implementation. class AutoResizeTextArea extends InputBase { render() { const { label, placeholder, wrap, ro ...

What is the specific jQuery event triggered when utilizing the append function on a textarea element?

I am currently setting up a system to detect any modifications in a textarea: <textarea id="log-box__data"></textarea> Modifications are made to the textarea exclusively using jQuery's append method: $(document).on('click', &a ...

Issue with modal input causing directive template to not render

I am working on an angular-bootstrap modal where I created a custom directive to automatically focus on the input field when opened. However, after adding the directive template to my input tag, I couldn't see it when inspecting the element. Here is t ...

Can anyone explain the meaning of (0, _jquery["default"]) in relation to jQuery selectors or functions?

Trying to implement jQuery on an offline page can be challenging when dealing with EmberJS, RequireJS, and other technologies. My goal is to replace complex code with simple jQuery. The HTML below should respond to user interaction: Loading i ...

information directed towards particular positions on a meter

I am in the process of creating a dashboard skin that receives data from a game via a plugin. I have encountered a problem with the RPM gauge. The issue is that the angle from 0 to 5 on the gauge is smaller than the angle from 5 to 10. I am attempting to s ...

What is the best way to iterate through an object of objects in Vue.js using mapping?

I am looking to develop a function that maps different items to specific color thresholds. Here is an example of what I have in mind: export const mapMetricsToValue: any = { item1: { 0: 'green--text', 0.3: 'red--text&apo ...