/ content / 2026-02-03-loading-modules-via-normal-script.md
2026-02-03-loading-modules-via-normal-script.md
 1  +++
 2  title = "Svelte state sharing? Just use classes. They're fine."
 3  date = 2025-05-31
 4  draft = true
 5  
 6  [taxonomies]
 7  tags = ["JavaScript", "Modules", "HTML"]
 8  +++
 9  
10  Need to load a JavaScript (ES) module script with `type=module` but don't have access to modify the html. Well you can do it through a standard "classic" script. Here's how.
11  
12  ```js
13  const script = document.createElement("script");
14  script.type = "module";
15  script.src = "http://localhost:5173/src/main.ts";
16  document.body.appendChild(script);
17  ```