Search code examples
phplaravelvue.jscaching

Clear javascript source cache laravel 5.8


I create company profile website using laravel 5.8 and vue js for make it reactive, it's not SPA(single page application) maybe we can call it hybrid, everything run well in local, after i modify javasacript locally then run a command yarn watch to compile and run my web again it runs well. let's say i have uploaded my project to shared hosting. then i modify my javascript code then re-upload my app.js code and here's a problem. the browser loads my previous app.js not my new app.js. i have cleared browser cache it's sill load the previous app.js. how to solve this problem? thanks


Solution

  • put a random number at the end of address like this:

    <script type="text/javascript" src="app.js?v=12392823"></script>