---
title: "CommonJS is hurting JavaScript"
description: "CommonJS, born in 2009 from the ServerJS effort to give server-side JavaScript a module system, became Node's default but carries core flaws: synchronous loading, poor tree-shaking, and no native browser support."
url: "https://swe.quest/articles/commonjs-is-hurting-javascript-f7a3d21e2d8d36ce"
canonical: "https://deno.com/blog/commonjs-is-hurting-javascript"
source: "Deno"
published: "2023-06-30"
difficulty: "easy"
kind: "Opinion"
reading_minutes: 5
tags: ["javascript","build-systems"]
---

# CommonJS is hurting JavaScript

A post on [Deno](https://swe.quest/sources/deno.md), published 2023-06-30, 5 min read, Opinion. Original: [https://deno.com/blog/commonjs-is-hurting-javascript](https://deno.com/blog/commonjs-is-hurting-javascript)

## Summary

CommonJS, born in 2009 from the ServerJS effort to give server-side JavaScript a module system, became Node's default but carries core flaws: synchronous loading, poor tree-shaking, and no native browser support. ECMAScript modules fix these as a web-first standard, yet Node's decision to support both systems pushed the interoperability burden onto package authors, who must ship complex dual ESM/CJS package.json configurations. The argument is to abandon CommonJS for an all-ESM future, with tools like dnt as a stopgap for dual publishing.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [Build systems](https://swe.quest/tags/build-systems.md) (Engineering practices)

## Prerequisites

- JavaScript modules ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))
- Node.js basics ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))

## Keywords

CommonJS, ECMAScript modules, Node.js, Deno, dnt, npm

## Related posts

- [CommonJS is not going away](https://swe.quest/articles/commonjs-is-not-going-away-37cb3b514e9c598b.md): Bun · 2023-06-30 · Medium · 5 min read · JavaScript, Runtimes & VMs, Performance engineering
  CommonJS remains the dominant format on npm (about 74% of popular packages in late 2022), so Bun now implements it natively as of v0.6.5 instead of transpiling it to a synchronous ESM form.
- [How to convert CommonJS to ESM](https://swe.quest/articles/how-to-convert-commonjs-to-esm-9c73f208d2b9fb43.md): Deno · 2024-10-16 · Medium · 4 min read · JavaScript, Refactoring & migrations
  Migrating a CommonJS codebase to ECMAScript modules means replacing require/module.exports with import/export and using fully specified paths that include file extensions.
- [Bun v0.6.7](https://swe.quest/articles/bun-v0-6-7-7c277e48946bb12b.md): Bun · 2023-06-02 · Medium · 4 min read · JavaScript, Runtimes & VMs
  Bun v0.6.7 fixes Node.js compatibility bugs in Node-API, node:http, undici, WebSocket, node:net and CommonJS/ESM interop, which lets Prisma, Discord.js and Puppeteer run in Bun.
- [Bun v0.6.10](https://swe.quest/articles/bun-v0-6-10-c9f67c1760f76c0a.md): Bun · 2023-06-26 · Medium · 8 min read · JavaScript, Runtimes & VMs, Testing, Build systems
  Bun v0.6.10 rewrites CommonJS module loading for better Node.js compatibility.
- [Bun v0.6.5](https://swe.quest/articles/bun-v0-6-5-84c0b0fc152a661a.md): Bun · 2023-05-29 · Medium · 4 min read · JavaScript, Runtimes & VMs, Build systems
  Bun reimplements CommonJS as native runtime support instead of transpiler-only wrapping.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
