I assume that a popular use case for <script type="module"> is to load the "main module" from which all project dependencies are resolved using the import statement tree. However, on the Internet it seems that this will create a bottleneck because the browser cannot know which scripts to load until it analyzes their dependents for import . Compare this to the situation where all project scripts reference individual <script> elements in the originally loaded HTML file. Scripts can be loaded in parallel, as well as after parsing HTML.
Will <script type="module"> create a boot bottleneck? Can several <script type="module"> elements on a page provide dependencies to each other, so the browser doesnβt need to load and parse JavaScript to figure out what to load next?
I assume this will be use for HTTP / 2 PUSH_PROMISE? The server will need to statically analyze JavaScript files and determine their dependencies in advance. But even if the browser might be prompted to load modules at an early stage, I wonder if the pushed modules will not execute until import is parsed. At least with <script> , I know that they would execute as soon as possible.
performance javascript html module networking
Jackson
source share