blockchain-lab-um / masca

Snap for managing VCs and DIDs in MetaMask
https://masca.io
Apache License 2.0
54 stars 16 forks source link

[bug](Veramo DID EBSI Provider): Named export 'ec' not found #447

Closed cre8 closed 1 year ago

cre8 commented 1 year ago

Describe the bug

I wanted to integrate the plugin into my nestjs application that is compiling into ESM so I can use the veramo SDK. tsconfig:

{
  "compilerOptions": {
    "module": "NodeNext",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "ESNext",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false,
    "moduleResolution": "NodeNext",
    "typeRoots": ["node_modules/@types", "types"]
  }
}

But after integrating the ebsi plugin, I get this error:

SyntaxError: Named export 'ec' not found. The requested module 'elliptic' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'elliptic';
const { ec: EC } = pkg;

With the suggested edit of the import it works. So I want to ask if there is a misconfiguration in my tsconfig file or if the package needs to update the import, there is no information provided on npm for the it.

To Reproduce

No response

Expected behavior

No response

martines3000 commented 1 year ago

Hi. We fixed this bug in other places in our monorepo, but we didn't have time to write tests for the did:ebsi provider (only manual testing), so it was left mostly untouched since our initial release.

I just resolved this issue and will create a new beta release for it. I will link the version of the updated package in a separate comment when it's available. 

If you encounter any other issues, fell free to report them. If you need additional guidance, you can also ask questions in our support channel on Discord.

martines3000 commented 1 year ago

@cre8 https://www.npmjs.com/package/@blockchain-lab-um/did-provider-ebsi/v/1.1.0-beta.0

Version: 1.0.0-beta.0