doc: rephrase dynamic import() description

The description is updated to clarify that dynamic import() is
asynchronous, dynamic, and works in both CJS and ESM contexts.
The new phrasing also avoids implying it is the only method for
loading ES modules in CommonJS.

Fixes: https://github.com/nodejs/node/issues/59077
PR-URL: https://github.com/nodejs/node/pull/59224
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Nam Yooseong 2025-09-12 15:40:24 +09:00 committed by GitHub
parent 29738c7b42
commit 071414dac8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -334,8 +334,9 @@ fs.readFileSync === readFileSync;
## `import()` expressions
[Dynamic `import()`][] is supported in both CommonJS and ES modules. In CommonJS
modules it can be used to load ES modules.
[Dynamic `import()`][] provides an asynchronous way to import modules. It is
supported in both CommonJS and ES modules, and can be used to load both CommonJS
and ES modules.
## `import.meta`