-
Notifications
You must be signed in to change notification settings - Fork 19
Conversation
I guess that also changes behavior for extension-less files, right? |
I would mention Other new things per the post are:
|
Was there ever a consensus on handling hashbang entry points? Is there going to be a node-esm alias for convenience. |
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.
Approved FWIW :)
Should we link to the work-in-progress blog post as part of the PR to give background? I feel like bullets don't exactly give the entire process justice.
Perhaps also mention the --es-module-specifier-resolution
flag is experimental while we determine what the default behaviour will be, as opposed to the flag itself being the feature.
updated ptal |
It still doesn’t mention that native modules are unsupported in |
9434bfb
to
c0bf5b3
Compare
Have now incorporated all fixes from from Q/A |
Updated copy for PR message. PTAL |
c0bf5b3
to
5efc4fb
Compare
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.
I fixed some missing backticks and other very minor formatting. LGTM.
268993e
to
cb0d7d1
Compare
Refs: https://github.com/GeoffreyBooth/node-import-file-specifier-resolution-proposal Refs: nodejs/modules#180 Refs: #6 Refs: #12 Refs: #28 Co-authored-by: Myles Borins <[email protected]> Co-authored-by: John-David Dalton <[email protected]>
There are currently two supported values "explicit" and "node"
With the new flag `--experimental-json-modules` it is now possible to import .json files. It piggy backs on the current cjs loader implementation, so it only exports a default. This is a bit of a hack, and it should potentially have it's own loader, especially if we change the cjs loader at all. The behavior for .json in the cjs loader matches the current planned behavior if json modules were to be standardized, specifically that a .json module only exports a default. Refs: nodejs/modules#255 Refs: whatwg/html#4315 Refs: WICG/webcomponents#770
Co-authored-by: Myles Borins <[email protected]>
Co-authored-by: Myles Borins <[email protected]> Co-authored-by: Evan Plaice <[email protected]>
cb0d7d1
to
484d1fb
Compare
I've finished incorporating all of @guybedford's suggested changes and rebasing the branch to be pristine. Each individual commit passes the test suite, so this is IMHO ready to upstream. CI: https://ci.nodejs.org/job/node-test-pull-request/21625/ Once CI is green I'll be opening this PR, ETA 2 - 3 hours |
landed in modules-lkgr in 969c63a...484d1fb upstream PR incoming |
This is what I plan to upstream tomorrow.
—
This PR updates the current
--experimental-modules
implementation based on the work of the modules team and reflects Phase 2 of our new modules plan.A longer form description of these changes can be found in our draft blog post.
The largest differences from the current implementation include
packge.type
which can be eithermodule
orcommonjs
type: "commonjs"
:.js
is parsed as commonjstype: "module"
:.js
is parsed as esm--type=[mode]
to let you set the type on entry point. Will overridepackage.type
for entry point..cjs
.module
mode.--es-module-specifier-resolution=[type]
explicit
(default) andnode
--es-module-specifier-resolution=node
to enable the commonjs specifier resolution algorithm--experimental-json-loader
"type": "module"
import 'thing.json'
will go through the experimental loader independent of modepackage.main
to set an entry point for a moduletype
of the module—
Did I miss anything?