---
title: "CommonJS is not going away"
description: "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."
url: "https://swe.quest/articles/commonjs-is-not-going-away-37cb3b514e9c598b"
canonical: "https://bun.com/blog/commonjs-is-not-going-away"
source: "Bun"
published: "2023-06-30"
difficulty: "medium"
kind: "Opinion"
reading_minutes: 5
tags: ["javascript","runtimes","performance"]
---

# CommonJS is not going away

A post on [Bun](https://swe.quest/sources/bun.md), published 2023-06-30, 5 min read, Opinion. Original: [https://bun.com/blog/commonjs-is-not-going-away](https://bun.com/blog/commonjs-is-not-going-away)

## Summary

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. CommonJS loads faster because ES modules need two passes, parsing and linking the whole graph before evaluation, to support live bindings. In Bun, requiring Babel is about 2.4x faster than importing it (85ms saved, versus 1.8x / ~60ms in Node.js), which matters for serverless cold starts. Bun supports importing CommonJS from ESM, including the de-facto \`\_\_esModule\` annotation that maps \`exports.default\` to the default import.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [JavaScript](https://swe.quest/tags/javascript.md) (Languages)
- [Runtimes & VMs](https://swe.quest/tags/runtimes.md) (Compilers & runtimes)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

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

## Keywords

Bun, CommonJS, ES Modules, Node.js, Babel, npm, \_\_esModule

## Related posts

- [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.
- [Bun v0.7.1](https://swe.quest/articles/bun-v0-7-1-5c9040e5c49cc1d7.md): Bun · 2023-07-29 · Medium · 8 min read · JavaScript, Runtimes & VMs, Performance engineering
  Bun v0.7.1 makes ES Module loading 30%–250% faster by running its transpiler concurrently for import statements and dynamic imports, though CommonJS require is still sequential.
- [CommonJS is hurting JavaScript](https://swe.quest/articles/commonjs-is-hurting-javascript-f7a3d21e2d8d36ce.md): Deno · 2023-06-30 · Easy · 5 min read · JavaScript, Build systems
  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.
- [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.

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)
