-
Notifications
You must be signed in to change notification settings - Fork 143
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
keyv doesn't work in pnpm monorepo #70
Comments
Sorry, I'm really not familiar with One idea might be that I try and auto-detect the correct module based on the connection string. Sounds like this might be where it's going wrong. I see you're using E.g instead of: const Keyv = require('keyv');
const keyv = new Keyv('mongodb://user:pass@localhost:27017/dbname'); Can you try: const Keyv = require('keyv');
const KeyvMongo = require('@keyv/mongo');
const keyvMongo = new KeyvMongo('mongodb://user:pass@localhost:27017/dbname');
const keyv = new Keyv({ store: keyvMongo }); |
Yes, requiring |
Ahh, so seems like I wouldn't really consider this a bug in Keyv so I'll close this issue. Glad you got it sorted though. Thanks for reporting, hopefully this issue will help anyone else who gets stuck using Keyv with |
This issue should be solved with optional peer dependencies. We don't support them yet but we will. (I believe Yarn already has support in the latest version) You basically have to add this to the "peerDependencies": {
"@keyv/mongo": "1"
},
"peerDependenciesMeta": {
"@keyv/mongo": {
"optional": true
}
} cc @arcanis |
I saw this error when I deployed my app to vercel. import Keyv from 'keyv'
import '@keyv/mongo' // <=== |
Trying to use keyv and @keyv/mongo works with npm (duh), pnpm, but not if the project is a pnpm workspace. The error is "Error: Cannot find module '@keyv/mongo'".
Repro repo at https://github.com/dandv/pnpm-monorepo-keyv
Any idea what might cause this?
The text was updated successfully, but these errors were encountered: