-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
doc: import() #17395
doc: import() #17395
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,15 +33,14 @@ node --experimental-modules my-app.mjs | |
### Supported | ||
|
||
Only the CLI argument for the main entry point to the program can be an entry | ||
point into an ESM graph. In the future `import()` can be used to create entry | ||
points into ESM graphs at run time. | ||
point into an ESM graph. `import()` can also be used to create entry points | ||
into ESM graphs at run time. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only with an additional CLI flag There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. like i said in the first comment, this might need to wait until that flag goes away, but i can doc it as being available from there also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd go for documenting it as it is to get this in right now. |
||
|
||
### Unsupported | ||
|
||
| Feature | Reason | | ||
| --- | --- | | ||
| `require('./foo.mjs')` | ES Modules have differing resolution and timing, use language standard `import()` | | ||
| `import()` | pending newer V8 release used in Node.js | | ||
| `import.meta` | pending V8 implementation | | ||
|
||
## Notable differences between `import` and `require` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking nit: I know this was in the original text, but
import
is a statement and not a function so the()
should be removed. Same on line 43.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I just say "dynamic import" then? the majority of the community refers to it as
import()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe leave it alone then. (Hey, I said it was non-blocking!) I see that even the TC39 proposal uses
import()
and refers to it as "function-like". https://github.com/tc39/proposal-dynamic-import