Use ESM entrypoint for require(ESM) (#16958)

Co-authored-by: fisker Cheung <lionkay@gmail.com>
This commit is contained in:
Tatsunori Uchinoandfisker Cheung authored and GitHub committed 2025-01-21 12:17:24 +08:00
1 parent 97d8115d18
commit b64b0a88ba
3 files changed
+10 -1

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
#### Use ESM entrypoint for `require(ESM)` (#16958 by @tats-u)
Node.js 22.12 or later [can (experimentally) load ESM modules with `require` function](https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require) without runtime flags. This change enables `require` to load Prettier without the CommonJS entrypoint with almost only the ability to import the ESM entrypoint.
The feature to load ES modules with `require` is not completely stable but can be used without ExperimentalWarning as of Node 22.13.