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

Invalid ESM builds #40

Open
toteto opened this issue Aug 14, 2024 · 0 comments
Open

Invalid ESM builds #40

toteto opened this issue Aug 14, 2024 · 0 comments

Comments

@toteto
Copy link
Contributor

toteto commented Aug 14, 2024

While trying to use the @iden3 set of packages, core, crypto and merkletree, faced an issue with their ESM deliveries while trying to use in my ESM module.

Reproduction steps:

  1. Create new project
  2. Set the "type": "module" property in project.json
  3. Import @iden3/js-iden3-core in index.js

Repository: https://github.com/toteto/iden3-invalid-build

➜  iden3-invalid-build node .
(node:73502) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/antonioivanovski/dev/iden3-invalid-build/node_modules/@iden3/js-iden3-core/dist/node/esm/index.js:1
export * from './claim';
^^^^^^

SyntaxError: Unexpected token 'export'
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:356:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:305:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)

Node.js v20.11.0

Issues:

Workaround:
Currently using pnpm patch to patch the builds with fixes for the above mentioned issues. I have put all patches at: https://gist.github.com/toteto/f071db1a0495b426efbd2390a34790cf

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

1 participant