ES Modules: What Actually Works
The standard JavaScript module system, using import and export statements, supported natively in browsers and Node.js.
On this page
Why does it matter?
Modules organize code, enable tree shaking and load dependencies explicitly, replacing older global-script patterns.
What are the numbers?
- Syntax import and export statements
- Browsers script type="module" loads modules natively
- Node.js supports ES modules alongside CommonJS
- Static structure enables bundlers to remove unused code
What should I do?
- Write new code as ES modules
- Import only what is needed
- Use bundlers or import maps in production
- Keep module boundaries clear
- Migrate CommonJS gradually
What should I avoid?
Avoid:
- Global variables shared between scripts
- Circular dependencies
- Mixing module systems without understanding interop
- Hundreds of unbundled module requests in production
When should I get help?
Short answer Bring in help when modernizing a legacy JavaScript codebase.
Where this comes from
- MDN Web Docs — JavaScript modules
- Node.js — ECMAScript modules
The figures and practices above come from the sources listed.
Working on something like this?
We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.
Where to go next
Spotted something wrong? Report an error on this page. We correct on the page and say what changed.