Skip to content

doc: rephrase dynamic import() description #59224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

meteorqz6
Copy link
Contributor

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: #59077

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. esm Issues and PRs related to the ECMAScript Modules implementation. labels Jul 26, 2025
doc/api/esm.md Outdated
@@ -334,8 +334,13 @@ 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 a dynamic and asynchronous way to import modules,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sould we also document that dynamic import() is dynamic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment. I agree that the name dynamic import() is self-explanatory. I'll go ahead and remove that part to avoid redundancy.

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: nodejs#59077
@meteorqz6
Copy link
Contributor Author

Hi, @AugustinMauroy,

I have opened a PR to address the issue you reported #59077.

Your feedback and review on the changes would be greatly appreciated.

Thanks!

@AugustinMauroy
Copy link
Member

For me it's okay but let's wait what loader said

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. esm Issues and PRs related to the ECMAScript Modules implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doc(esm): import explaining need to be rephrased
5 participants