-
Notifications
You must be signed in to change notification settings - Fork 206
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
Native ESM #819
Comments
Hi @PhearZero, I am under the impression that having this line in our Line 6 in 7469c41
Can you please share more details about your environment (e.g. operating system, node version) and the exact error you're receiving? |
Hello @jasonpaulos !
This is true for most bundlers but it's actually not standardized, just a widely adopted key. The actual
Should be any node/os combination that supports Here is the reproduction repo using Node v18: https://github.com/PhearZero/js-algorand-sdk-node-18-module Steps:npm init
npm install algosdk Set package.json {
"type": "module"
} Import module import {Indexer} from 'algosdk'
// Error does not provide named export since it's using the cjs bundle |
Addressed in #836 |
❌ Problem
The following errors due to
node.js
resolving thecommonjs
bundle while using nativeesm
modules.Reproduction: https://github.com/PhearZero/js-algorand-sdk-node-18-module/tree/main
🤔Reasoning:
While modern bundlers have robust resolvers, it would be good to have first class support for
esm
without third party tools. This will also improve third party bundlers ability to tree shake.✅ Solution
Convert package to
esm
../dist/cjs/index.js
entrypoint. (fixed example using fork)./dist/esm/index.js
entrypoint. (fixed example using fork)📦Dependencies
This requires moving to
tsx
and slight refactoring of the codebase.Very low priority
The text was updated successfully, but these errors were encountered: