No known conditions for "./cid" specifier in "multiformats" package
Is there an existing issue for this?
- [X] I have searched the existing issues
SDK version
5.0.0
Lit Network
All
Description of the bug/issue
I'm trying to use the SDK in a project with Remix + Vite. I get the error:
✘ [ERROR] No known conditions for "./cid" specifier in "multiformats" package [plugin vite:dep-pre-bundle]
The plugin "vite:dep-pre-bundle" was triggered by this import
../node_modules/@lit-protocol/contracts-sdk/src/lib/contracts-sdk.js:34:18:
34 │ CID = require('multiformats/cid');
The error is triggered by this line in the contracts SDK package.
I'm not sure why this is the only dependancy imported with require(). I use the CID package in my project as well, where it is imported with:
import { CID } from 'multiformats/cid'
This error has only appeared after migrating Remix from their built-in bundler to Vite. However, while using this package before the migration the console was constantly spammed with "CID not found", so it looks like the import wasn't working in the first place.
Severity of the bug
Blocking
Steps To Reproduce
- Create a Remix + Vite project (you may also be able to reproduce this on any framework using Vite, but I haven't tried)
- Import the SDK and build
- Error triggered
Link to code
No response
Anything else?
No response
Is there any update on the progress of this issue? I'm trying to implement Lit, but blocked by this error.
Is there any update on the progress of this issue? I'm trying to implement Lit, but blocked by this error.
Yes, we have a PR up for this https://github.com/LIT-Protocol/js-sdk/pull/467
It's now published to 5.1.0!
Please let me know if this is working for you :) @aimensahnoun @0x62