From 5d41b8a8b0cc9f506d17ee81c082c98d68e951aa 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/55263 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 c63d3cf4d4e3bc..1f833640b192e2 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`][] @@ -1189,6 +1196,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