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 issue of using the package as an ESM module #28

Open
mkermani144 opened this issue Feb 19, 2023 · 0 comments
Open

Fix issue of using the package as an ESM module #28

mkermani144 opened this issue Feb 19, 2023 · 0 comments

Comments

@mkermani144
Copy link

If we try to use this package as an ESM module in Node (without any build tool), we get errors like this:

SyntaxError: Named export 'Explorer' not found. The requested module '@ergolabs/ergo-sdk' is a CommonJS module, which may not support all module.exports as named exports.

This happens because the type or exports field is missing in package.json. Currently used module field in package.json is neither supported, nor the support is planned in Node. It was a proposal which was introduced by some bundlers like esbuild, but Node introduced a more powerful exports field.

Note that if this package is meant to be used only as an ESM module, adding a "type": "module" will suffice.

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

No branches or pull requests

1 participant