From 70504f8522fe80161420689682d0c645beb1611c Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 2 Oct 2024 23:02:31 +0200 Subject: [PATCH] doc: update `require(ESM)` history and stability status PR-URL: https://github.com/nodejs/node/pull/55199 Backport-PR-URL: https://github.com/nodejs/node/pull/55265 Reviewed-By: Moshe Atlow Reviewed-By: Guy Bedford Reviewed-By: Joyee Cheung --- doc/api/modules.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/api/modules.md b/doc/api/modules.md index 16f93992f74775..fcc1718c716fc2 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -170,6 +170,13 @@ relative, and based on the real path of the files making the calls to ## Loading ECMAScript modules using `require()` + + +> Stability: 1.1 - Active Development. Enable this API with the +> [`--experimental-require-module`][] CLI flag. + The `.mjs` extension is reserved for [ECMAScript Modules][]. Currently, if the flag `--experimental-require-module` is not used, loading an ECMAScript module using `require()` will throw a [`ERR_REQUIRE_ESM`][] @@ -1153,6 +1160,7 @@ This section was moved to [GLOBAL_FOLDERS]: #loading-from-the-global-folders [`"main"`]: packages.md#main [`"type"`]: packages.md#type +[`--experimental-require-module`]: cli.md#--experimental-require-module [`ERR_REQUIRE_ASYNC_MODULE`]: errors.md#err_require_async_module [`ERR_REQUIRE_ESM`]: errors.md#err_require_esm [`ERR_UNSUPPORTED_DIR_IMPORT`]: errors.md#err_unsupported_dir_import