I'm using React and Webpack to create a completely front-end application. I just made some changes to my build. Now my concern is that my users won't get to use the latest bundle but the cached bundle by their browsers. How can I get them to load the latest bundle?
Asked
Active
Viewed 2,380 times
2 Answers
3
It is not recommended to add a code for loading assets forcefully in client browser as this will result in the slow rendering of application.
The task you want to achieve can be done by adding a new query parameter version on your script tag and change that version whenever you want to load new code.
something like
<script type="text/javascript" src="myfile.js?REVISION"></script>

Gaurav joshi
- 1,743
- 1
- 14
- 28
0
I found a trick. Try adding a query parameter in the script url.
For example:
http://example.com/scripts/bundle.js?something=something
I think that prevents browsers from caching the file.

vothaison
- 1,646
- 15
- 15