Title: Proposal for dual ESM/CommonJS packages · Issue #273 · nodejs/modules · GitHub
Open Graph Title: Proposal for dual ESM/CommonJS packages · Issue #273 · nodejs/modules
X Title: Proposal for dual ESM/CommonJS packages · Issue #273 · nodejs/modules
Description: @guybedford, @jkrems and I discussed the package dual-ESM/CommonJS case and we have a small proposal, based on the current ecmascript-modules implementation: The package.json "main" field reverts to its prior CommonJS-only use. A new fie...
Open Graph Description: @guybedford, @jkrems and I discussed the package dual-ESM/CommonJS case and we have a small proposal, based on the current ecmascript-modules implementation: The package.json "main" field reverts t...
X Description: @guybedford, @jkrems and I discussed the package dual-ESM/CommonJS case and we have a small proposal, based on the current ecmascript-modules implementation: The package.json "main" field...
Opengraph URL: https://github.com/nodejs/modules/issues/273
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Proposal for dual ESM/CommonJS packages","articleBody":"@guybedford, @jkrems and I discussed the package dual-ESM/CommonJS case and we have a small proposal, based on the current [ecmascript-modules implementation](https://github.com/nodejs/ecmascript-modules):\r\n\r\n- The `package.json` `\"main\"` field reverts to its prior CommonJS-only use.\r\n\r\n- A new field `\"exports\"` is created that takes a string like `\"./src/index.js\"`. This is the ES module entry point. `\"exports\"` is to `import` what `\"main\"` is to `require`.\r\n\r\nNotes:\r\n\r\n- `\"exports\"` may in the future take an object, preserving design space for the [package exports proposal](https://github.com/jkrems/proposal-pkg-exports).\r\n\r\n- If `\"exports\"` points to a `.js` file and `\"type\": \"module\"` is not set, an error is thrown similar to the “type mismatch” errors (like using `--type=commonjs` with an `.mjs` file). The error would also instruct the user to add `\"type\": \"module\"` to `package.json`. The `\"exports\"` field does not imply `\"type\": \"module\"`.\r\n\r\nAnd that’s it! This should cover the case while preserving design space for future proposals, and for Node potentially switching to ESM by default someday.","author":{"url":"https://github.com/GeoffreyBooth","@type":"Person","name":"GeoffreyBooth"},"datePublished":"2019-02-25T21:58:44.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":87},"url":"https://github.com/273/modules/issues/273"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8ead978f-d102-9f91-b33d-768641f679d2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C39A:204C81:8DE38E:BE475D:6A4D6F1A |
| html-safe-nonce | 12225d626551905617835fe5babd2e5a99a08c06da201206d47df4b75cf67c69 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMzlBOjIwNEM4MTo4REUzOEU6QkU0NzVEOjZBNEQ2RjFBIiwidmlzaXRvcl9pZCI6IjE3MDY5MTQxMzgwMTIwODYwNDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 850908b7904ad0ac745c76eb402491e411cffdcb61fc0366d7b7e0b3b59aad99 |
| hovercard-subject-tag | issue:414326880 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/modules/273/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2a427942d6f50c1cacda8a7ad82e652ac5aafa1037803ee990fbc4551d10c627/nodejs/modules/issues/273 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2a427942d6f50c1cacda8a7ad82e652ac5aafa1037803ee990fbc4551d10c627/nodejs/modules/issues/273 |
| og:image:alt | @guybedford, @jkrems and I discussed the package dual-ESM/CommonJS case and we have a small proposal, based on the current ecmascript-modules implementation: The package.json "main" field reverts t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | GeoffreyBooth |
| hostname | github.com |
| expected-hostname | github.com |
| None | c78260c7b3f4ac4b0356c8208537f05406a3a2d46a9ec3f735b372dcc519c39e |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/modules git https://github.com/nodejs/modules.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 119901830 |
| octolytics-dimension-repository_nwo | nodejs/modules |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 119901830 |
| octolytics-dimension-repository_network_root_nwo | nodejs/modules |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 399fff412f48461d435721c009efc17ea44be72f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width