Skip to main content

One post tagged with "browser"

View All Tags

How the Browser Loads Scripts

· 25 min read
Pere Pages
Software Engineer
The browser building a module graph from script tags and imported files

You add a <script> tag, the page runs your code. Underneath that one line the browser does a surprising amount of work: it decides when to run the script, fetches every file it depends on, figures out what each file is asking for, keeps every loaded module in memory so it runs exactly once, and evaluates them all in the right order. This is a tour of that machinery.