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

feat!: output ES modules instead of CommonJS #1205

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

MantisClone
Copy link
Member

@MantisClone MantisClone commented Oct 20, 2023

Fixes #1148

Description of the changes

  • Make all packages output ES modules instead of CommonJS modules with exceptions:
    • smart-contracts must remain a CommonJS module because Hardhat uses require() statements. smart-contracts now uses import() to dynamically import ES modules. Reference: Interoperability with CommonJS
  • Add .js and /index.js file extensions for all path specifiers. Reference: Mandatory File Extensions
  • Disable UMD bundling using Webpack in request-client.js, web3-signature, epk-signature, and epk-decryption.
  • Update dependencies, for type information:
    • dotenv
    • ipfs-unixfs
    • axios
  • Migrate from typed-emitter to tiny-typed-emitter
    • Fix error: src/ethereum-storage-ethers.ts(30,35): error TS2709: Cannot use namespace 'TypedEmitter' as a type.
  • Use default imports for Keyv, Bluebird, AJV, and FormData

@MantisClone MantisClone changed the title feat!: drop commonjs support feat!: output ES modules instead of CommonJS Oct 20, 2023
  * Eliminate dependency on utils from smart-contracts
  * Why? Unable to call async import function in non-function export
  * Because smart-contracts is CommonJS.
  * Use dynamic import() to import ES Modules in CommonJS.
@MantisClone
Copy link
Member Author

MantisClone commented Oct 23, 2023

TODO: Consider making currency and utils packages output ES modules AND CommonJS modules.

This would decrease the code churn in the smart-contracts package. smart-contracts could consume the CommonJS variants of the currency and utils packages, but everything else could consume the ES Module variants.

TODO: Consider making all packages output ES modules AND CommonJS modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant