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

ESM support #409

Open
vimwitch opened this issue Apr 18, 2023 · 2 comments
Open

ESM support #409

vimwitch opened this issue Apr 18, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@vimwitch
Copy link
Member

To support ethers 6 and hardhat 2.14 we need to import ESM modules. Big libraries in the ecosystem are moving to ESM so I think we can/should do the same. If we export an ESM module anyone using commonjs with not be able to import the unirep libraries. I think this is reasonable at this point given that nodejs, webpack, and browsers all support ESM out of the box.

Typescript support for ESM is mediocre at this point. The configuration is complicated, especially with tests/ts-node. I think this is a good opportunity to remove some parts of our systems that are typescript, specifically:

  • switch @unirep/contracts deploy/build/test logic to javascript
    • manually write a type definition for the deploy function

This issue is a pretty big lift and I think we should break it up into the following steps:

  1. Remove typechain support in @unirep/contracts
  2. Refactor @unirep/contracts to javascript
    • Manually write a type definition file for the deploy function
  3. Switch @unirep/core to ESM and ethers-v6
  4. (optional) switch @unirep/utils and @unirep/circuits to ESM

Related #366

@vimwitch
Copy link
Member Author

@vivianjeng let me know what you think of this

@vivianjeng
Copy link
Member

yeah I think we can support v6 first
and then figure out if there is another way to switch back to ts (I think it might be possible)

@vivianjeng vivianjeng added the enhancement New feature or request label May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants