[Vuejs]-Cache misses for lazy loaded resources (using dynamic imports)

0👍

So far I have not found anything better than including all the scripts, I need on the page, in its <head> section. Moreover only using <script> tag helped; <link href="..." rel="preload" as="script"> was useless.

0👍

Use a version parameter for the script url.

There’s a code snippet that showcase this:

<script type="text/javascript" src="myApp.umd.min.js?v=123"></script> 

Also this is a valid solution:

<link rel="preload" href="myFont.woff2" as="font"
      type="font/woff2" crossorigin="anonymous">

From docs:

A rel value of preload indicates that the browser should preload this resource with the as attribute indicating the specific class of content being fetched. The crossorigin attribute indicates whether the resource should be fetched with a CORS request.

Leave a comment