Skip to content
Web Design & Development

ES Modules: What Actually Works

The standard JavaScript module system, using import and export statements, supported natively in browsers and Node.js.

MediaScaleUp Editorial Team 2 min read 10 views
ES Modules: What Actually Works

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?

  1. Write new code as ES modules
  2. Import only what is needed
  3. Use bundlers or import maps in production
  4. Keep module boundaries clear
  5. Migrate CommonJS gradually
What to do and what to avoid with ES modules, side by side
Good practice against the usual mistakes, from the sources listed below.

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

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.

All services

The work behind this article, and what it costs.

MediaScaleUp Editorial Team

Articles here are researched, written and checked by the MediaScaleUp studio team before they are published, and dated when they are reviewed.

Keep reading

More in Web Design & Development