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

Split the build into two: one for CommonJS modules and one for ESM #243

Closed
mmv08 opened this issue Aug 23, 2022 · 3 comments
Closed

Split the build into two: one for CommonJS modules and one for ESM #243

mmv08 opened this issue Aug 23, 2022 · 3 comments

Comments

@mmv08
Copy link
Member

mmv08 commented Aug 23, 2022

Context / issue

If you use NodeJS and ESModules, the library imports do not work as expected, you can see an example in this issue:
https://ethereum.stackexchange.com/questions/133776/error-in-deploying-a-safe-methods-is-empty

It means that for ESM you have to do this:

import SafeCoreSDK from '@gnosis.pm/safe-core-sdk'

console.log(SafeCoreSDK)
// {
//  default: SafeCoreSDK
// }
const SDK = SafeCoreSDK.default

Proposed solution

Separate builds for esm and commonjs like other libraries do. An example - https://github.com/gnosis/evm-proxy-detection

Alternatives

Can't see any

Additional context

@mmv08
Copy link
Member Author

mmv08 commented Oct 1, 2022

I've also just discovered that this completely breaks types with typescript

@dasanra
Copy link
Collaborator

dasanra commented Aug 28, 2023

Example on how to do this based on safe-apps-sdk safe-global/safe-apps-sdk#512

@dasanra
Copy link
Collaborator

dasanra commented Jan 31, 2025

Almost done in PR #1049 . We will be using #514 as the main ticket.

@dasanra dasanra closed this as completed Jan 31, 2025
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

2 participants