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

Lack of CommonJS support #49

Closed
KyrneDev opened this issue Feb 28, 2023 · 3 comments
Closed

Lack of CommonJS support #49

KyrneDev opened this issue Feb 28, 2023 · 3 comments
Assignees

Comments

@KyrneDev
Copy link

Hello,

Currently, this package doesn't support CommonJS modules, the build files are esModule only. This is causing a pretty big headache for my project that relies on a heavy set of jest tests.

I'm having to use the experiment VM modules option for node, which in turn is causing seg faults on our CI.

Would be great to have proper CommonJS support if possible.

@vmidyllic
Copy link
Contributor

sorry for the late reply, is it still actual?

@KyrneDev
Copy link
Author

Hey @vmidyllic, yes, this issue is still occurring. There is no commonJS support on the latest version.

@Kolezhniuk Kolezhniuk self-assigned this Apr 6, 2023
@vmidyllic
Copy link
Contributor

vmidyllic commented Apr 7, 2023

@KyrneDev v1.0.0-beta.7 contains explicit CommonJS build support. (added in #56 )

But the issue with tests - is not about CommonJS build of js-iden3-auth lib.
There is a dependency digitalbazzar/jsonld.js that utilizes its own http client which supports only ESM build.
They have an issue here.
digitalbazaar/jsonld.js#516
in which they describe the way of avoiding such issue.
As soon as they have a fix we will integrate it.

For now, you stick to the approach they recommend or the one which we use in our tests (without experimental feature support):

  1. add mocked folder
    https://github.com/iden3/js-iden3-auth/tree/develop/__mocks__/%40digitalbazaar/http-client/dist/cjs
  2. change jest config.
    https://github.com/iden3/js-iden3-auth/blob/develop/jest.config.js

Also, when we wrote tests using the mocha framework we didn’t face a such error.

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

3 participants