You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
Repository navigation
Commit 9672f7c
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: doc/plan-for-new-modules-implementation.md
+7-9Lines changed: 7 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,9 +99,9 @@ Phase 3 improves user experience and extends the MVP. Phase 3 is malleable based
99
99
- Should loaders be per package, per application or either?
100
100
-**Status**: In development.
101
101
102
-
*Map the paths within modules, providing similar functionality as the browser’s [import maps proposal](https://github.com/WICG/import-maps#packages-via-trailing-slashes).
102
+
*`"exports"` field: for consumers of a package, map the paths of deep imports to provide encapsulation (an explicit public API); pretty specifiers (no file exensions or paths that include things like `dist/`) and flexibility for future package versions renaming or moving files without affecting the package’s public API. Applies to both ESM and CommonJS.
* Dual CommonJS/ESM packages: Either support packages with both CommonJS and ESM sources that can be used in either environment; or decide to specifically not support dual CommonJS/ESM packages.
122
117
- Status quo is current `--experimental-modules` behavior: `"main"` points to exactly one file, and all file extensions are mandatory (by default), so there is no possibility of an `import` specifier pointing to different files in ESM versus CommonJS. Recommended practice for dual packages is to have `"main"` point to the CommonJS entry point and have users use a deep import, e.g. `/module.mjs`, to access ESM entry point.
123
118
- PR to document status quo: https://github.com/nodejs/node/pull/27957.
@@ -139,6 +134,9 @@ Phase 3 improves user experience and extends the MVP. Phase 3 is malleable based
139
134
* Better mechanism for creating `require` function: `createRequire`.
140
135
- Landed in https://github.com/nodejs/node/pull/27405 and shipped in 12.2.0.
141
136
142
-
### Abandoned
137
+
### Tabled
143
138
144
-
Proposals that the group has decided not to pursue will be listed here, along with explanations.
139
+
* Provide a way to make ESM the default instead of CommonJS.
-**Status**: Currently one can add `--input-type=module` to `NODE_OPTIONS` to flip the default for `--input-type`; at the moment the group is deciding not to pursue providing an ability to flip the default for the `package.json``type` field. We instead want to encourage all packages, both ESM and CommonJS, to include an explicit `type` field; leaving it out and relying on a default is something we want to discourage.
0 commit comments