-
Notifications
You must be signed in to change notification settings - Fork 895
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
Make packages proper ESM with "type": "module" #121
Comments
Hmm. What effect does this have on downstream apps or projects that depend on the library? Do they also need to be ESM modules? We'd need to know whether this breaks compatibility with existing starter projects, projects like dapp-scaffold, etc. but I'm open to the idea, and a PR to evaluate would be welcome. |
This is indeed a bit of a risky move, so we'd need to test the bundler behavior in a scenario where the package is imported from a "commonjs" setup. It might require some additional config in the package.json's |
Please let me know what you find out, a PR would help understand the tradeoffs. |
I've tested out building the library after converting all the relevant packages to ESM: #132 It seems to work okay, since apps that use this already need to transpiling the modules one way or another and the import/export syntax hasn't changed. This could be expanded to build ESM and CJS versions if needed, but I'd rather not unless there's an obvious benefit. Let me know what you think. |
This has been implemented. All the core and wallet packages are ESM modules. The React, Angular, and Vue UI packages are not, as I ran into issues with these when using |
Published:
|
Is your feature request related to a problem? Please describe.
The packages from this repo currently export modules in "loose" ESM format which means you cannot import them into a webpack 5 or nodejs project that uses "native" node ESM module resolution.
Describe the solution you'd like
We could solve it by making the files in
lib/*
proper ESM (add file extensions to imported module specifiers) and add"type": "module"
topackage.json
.See https://webpack.js.org/guides/ecma-script-modules/ for more details
The text was updated successfully, but these errors were encountered: