user3616544
user3616544

Reputation: 1069

Angular app always using cached version without hard refresh manually

I have Angular 7 application deployed to Azure App Services. After each new deployment, even if I start a new browser, I have to manually refresh or hard refresh the browser page in order to see the new changes.

I can see in my deployment, the index.html file does have the new hashed file name embedded each time.

<script type="text/javascript" src="runtime.5959ec9531e22bc6ae82.js"></script>
<script type="text/javascript" src="es2015-polyfills.d9df4d9cef7e9c40c764.js" nomodule></script>
<script type="text/javascript" src="polyfills.eb0596823492af2b4693.js"></script>
<script type="text/javascript" src="main.1eb70d066995e0724818.js"></script>

Why the application didn't reload the index.html automatically? How to solve this problem?

Upvotes: 0

Views: 2262

Answers (1)

Florian Rubel
Florian Rubel

Reputation: 124

The generated index.html which contains the links to your latest scripts is cached.

I would recommend to disable the caching for the location /index.html file only, so the browser ALWAYS loads at least the index.html.

Because the generated css and js contains a hash in the filename that changes if the resulted file changes after the build, the user should always get the latest version.

Upvotes: 1

Related Questions