A JavaScript module organizes code in a file and shares definitions through `export` and `import`. Definitions that are not exported stay scoped to their file, avoiding pollution of the global namespace. section 3.5 section 1.2
Loading a script as a module also changes how the browser handles it:
- Module scripts load asynchronously, execute after HTML parsing, and run only once even if imported multiple times. section 3.5
- They run in strict mode and enforce cross-origin request restrictions. section 3.5
Loading a web component
Use a script element with `type="module"` to include web component code. Test it from a local HTTP server; opening a local HTML file can prevent module scripts from loading. section 3.12 section 3.5
Vite is one option for local development: it provides an HTTP server, ECMAScript Module support, and hot module replacement. section 3.5











































