In addition to sequential loading, is there any other way to load a certain js file first?
认证0级讲师
You can consider using preload/prefetch, the usage method is as follows:
preload/prefetch
<link rel="preload" href="xx.js" as="script">
Related information: Preload: What Is It Good For?What should you know about Preload? Chinese translation of the above article
The simplest way is to write the priority js file in the page and load other js files in onload.
Little Red Book, Chapter 2, 2.1 "script" element async: Optional, indicating that the script should be downloaded immediately, but does not hinder other operations on the page. Give it a try.
script tag is placed first
You can consider using
preload/prefetch
, the usage method is as follows:Related information:
Preload: What Is It Good For?
What should you know about Preload? Chinese translation of the above article
The simplest way is to write the priority js file in the page and load other js files in onload.
Little Red Book, Chapter 2, 2.1 "script" element async: Optional, indicating that the script should be downloaded immediately, but does not hinder other operations on the page. Give it a try.
script tag is placed first