Back to news
backend Priority 4/5 4/22/2026, 11:05:09 AM

Node.js 23.8.0 enables synchronous require of ES modules by default without flags

Node.js 23.8.0 enables synchronous require of ES modules by default without flags

Node.js 23.8.0 has been officially released, introducing a major change that enables the loading of ECMAScript modules via require() by default. This feature was previously behind an experimental flag and is designed to bridge the gap between CommonJS and ESM environments. By allowing synchronous loading of ESM, developers can now integrate newer modules into legacy codebases with significantly less friction. The technical implementation allows require() to process ESM files as long as they do not contain top-level await. If a module contains top-level await, Node.js will still throw an error, as those modules must remain asynchronous. This update streamlines the developer experience by removing the need for the --experimental-require-module flag which was mandatory in earlier versions. For enterprise applications and library maintainers, this change reduces the complexity of supporting dual-module packages. It encourages the adoption of ESM while maintaining compatibility with the vast ecosystem of CommonJS scripts. Developers are advised to test their dependency chains to ensure that modules intended for synchronous require do not inadvertently introduce asynchronous constraints.

#nodejs#javascript#esm#commonjs

Comparison

AspectBefore / AlternativeAfter / This
ESM loading in CJSDynamic import() or experimental flagSynchronous require() by default
CLI Flags--experimental-require-module requiredNo flags needed for standard ESM
Top-level await ESMMust use dynamic import()Still requires dynamic import() (error on require)

Action Checklist

  1. Update local Node.js environment to version 23.8.0 or higher Verify version using node -v command
  2. Identify CommonJS files that currently use dynamic import() for ESM Check if these can be replaced with synchronous require() for simplicity
  3. Audit dependent ESM packages for top-level await usage Modules with top-level await cannot be loaded via require()
  4. Remove deprecated experimental flags from start scripts Clean up package.json scripts that used --experimental-require-module

Source: Node.js Open Source Project

This page summarizes the original source. Check the source for full details.

Related