Skip to content
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

build: 'module' type for root package #4789

Merged
merged 9 commits into from
Mar 10, 2022
Merged

Conversation

turadg
Copy link
Member

@turadg turadg commented Mar 9, 2022

enough progress on #4788 to unblock #4722

Description

Uses Node.js's type field to make the root package be loaded as ES modules (ESM) instead of CommonJS (CJS).

For modules that need to be CJS, change the extension to .cjs.

Security Considerations

--

Documentation Considerations

There is something about how to transition packages to ESM which I think still applies: https://github.com/Agoric/agoric-sdk/blob/45f9ada36e859a42cff529eaf77fad9a464678ed/COVERAGE.md#nodejs-esm-support

Testing Considerations

Simplifies Ava config.

@turadg turadg linked an issue Mar 9, 2022 that may be closed by this pull request
@turadg turadg changed the title 4788 remove esm module loader build: 'module' type for root package Mar 10, 2022
@turadg turadg requested a review from kriskowal March 10, 2022 17:18
@turadg turadg marked this pull request as ready for review March 10, 2022 17:18
@@ -5,8 +5,7 @@
"parsers": {
"js": "mjs"
},
"main": "src/index.js",
"module": "src/index.js",
"main": "src/index.cjs",
Copy link
Member

Choose a reason for hiding this comment

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

The "parsers" above can also be removed (anywhere you encounter them going forward). They were necessary for Endo to briefly (and badly) straddle compatibility with both RESM and NESM.

@turadg turadg added the automerge:squash Automatically squash merge label Mar 10, 2022
@mergify mergify bot merged commit 3adfc00 into master Mar 10, 2022
@mergify mergify bot deleted the 4788-remove-esm-module-loader branch March 10, 2022 20:09
dtribble pushed a commit that referenced this pull request Mar 13, 2022
* chore: remove dead ava config from cosmos package

* chore: module config that works for Ava

* chore: cjs for files that have require()

* fix ui-components test

* fix lint

* fixup! chore: cjs for files that have require()

* remove 'parsers' field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge:squash Automatically squash merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove remaining 'esm' module loader dependencies
2 participants