Vite build .js file in rolling update deployment strategy

123 views Asked by At

I have an issue and I'm not sure how to approach it, maybe someone can help I'm using ECS rolling deployment, which means it is setting up the container, and once it's healthy and ready to use it dropping the previous revision and I have a load balancer in front of it now when I deploy a new revision I sometimes get this error in my browser Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html"

the reason is that the load balancer probably points to a different container while rolling the update so when I hit the domain it tries to load the asset /assets/chunk-[hash].js and when it tries to hit that chunk-hash.js it probably goes to the new revision where this file does not exist because on every build the hash generated is unique

I haven't found any solution whatsoever online but I think the solution for this is to use the same chunk name. or do you have any other recommendations?

Thanks!

0

There are 0 answers