<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Commonjs on Commentary of Takao</title><link>https://takao.blog/en/tags/commonjs/</link><description>Recent content in Commonjs on Commentary of Takao</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>Commentary of Takao</copyright><lastBuildDate>Sat, 13 Jun 2026 23:11:50 +0900</lastBuildDate><atom:link href="https://takao.blog/en/tags/commonjs/index.xml" rel="self" type="application/rss+xml"/><item><title>Node.js Stable Support for Requiring ESM Modules</title><link>https://takao.blog/en/web/node-esm-require-support-stable/</link><pubDate>Wed, 05 Nov 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/node-esm-require-support-stable/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Node.js Stable Support for Requiring ESM Modules" /&gt;&lt;h2 id="nodejs-stable-support-for-requiring-esm-modules"&gt;Node.js Stable Support for Requiring ESM Modules
&lt;/h2&gt;&lt;p&gt;For years, Node.js developers faced a painful divide: &lt;strong&gt;CommonJS&lt;/strong&gt; (CJS) and &lt;strong&gt;ES Modules&lt;/strong&gt; (ESM) coexisted with limited interoperability. CJS code could &lt;code&gt;import()&lt;/code&gt; ESM modules asynchronously, but &lt;code&gt;require()&lt;/code&gt; — the synchronous loading mechanism at the heart of CJS — could not load ESM at all. This forced codebase migrations to be all-or-nothing affairs.&lt;/p&gt;
&lt;p&gt;That changed with Node.js 22 and 23, which stabilized the &lt;code&gt;--experimental-require-module&lt;/code&gt; flag. As of Node 23, synchronous &lt;code&gt;require()&lt;/code&gt; can load ES modules, provided the ESM graph does not use top-level await.&lt;/p&gt;</description></item></channel></rss>