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.
Comparison
| Aspect | Before / Alternative | After / This |
|---|---|---|
| ESM loading in CJS | Dynamic import() or experimental flag | Synchronous require() by default |
| CLI Flags | --experimental-require-module required | No flags needed for standard ESM |
| Top-level await ESM | Must use dynamic import() | Still requires dynamic import() (error on require) |
Action Checklist
- Update local Node.js environment to version 23.8.0 or higher Verify version using node -v command
- Identify CommonJS files that currently use dynamic import() for ESM Check if these can be replaced with synchronous require() for simplicity
- Audit dependent ESM packages for top-level await usage Modules with top-level await cannot be loaded via require()
- 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.


