How do I prevent browser caching of webpack bundle?

Viewed 3108

I am using webpack to bundle a react app in a js file which I want add to client site. So I end up with a app.js and I can provide a url for where the file is hosted to clients https://example.mysite.com/apps/app.js and this can be included via a script tag on client site. Simple enough.

The issue I might run into here is browser side caching. I can't use version tags here because asking a client to continuously update code on their site is not a realistic expectation.

Webpack hashing is also not an option because this would mean updating the file on the client side, which again is something I would like to work around.

Is there a way to prevent my app.js file from being cached and fetching a new version of the file every time the app.js file has changed?

0 Answers
Related