Message from JavaScript discussions

October 2020

— Scripts are executed in order of how they are loaded, unless you put async/defer on them

— 

I need to dynamically add the script tags but they should be loaded and executed before other script tags that are not dynamically added

— The other script tags are already part of the initial html

— Then you need a script before all other scripts that controls loading of ALL scripts.

— Is there no other way?

— There is no way with html only to make sure, that the first script is done executing (especially if it involves async loading of new content) before other scripts load

Message permanent page

— No no no, no need to guess

— Cant I block loading and executing of static scripts with dynamically added scripts?

— Maybe what you want is module bundling

— 

import(...).then(restOfScript)
?

— You just have to dynamically add all then

— Exactly