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

fix problem when required from CommonJS #335

Merged
merged 1 commit into from
Dec 23, 2023

Conversation

jiftechnify
Copy link
Contributor

When CommonJS modules of this package are imported from node scripts under the "CJS context", an error occurs:

Error [ERR_REQUIRE_ESM]: require() of ES Module /...snip.../node_modules/nostr-tools/lib/cjs/index.js from /...snip.../user_script.js not supported.
index.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.

This is due to this change, and I fixed it by applying this hack to the CJS build instead of the ESM build.

@fiatjaf fiatjaf merged commit a43f2a7 into nbd-wtf:master Dec 23, 2023
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants