Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: import() is supported now
  • Loading branch information
devsnek authored Nov 30, 2017
commit 9917d7601b36068d2408b0be3f9b6ac5a781fed0
5 changes: 2 additions & 3 deletions doc/api/esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

@devsnek devsnek Dec 1, 2017

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()

Copy link
Copy Markdown
Member

@Trott Trott Dec 1, 2017

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

into ESM graphs at run time.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only with an additional CLI flag --harmony_dynamic_import.

Copy link
Copy Markdown
Member Author

@devsnek devsnek Dec 6, 2017

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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`
Expand Down