[solved] Can't use `@solidjs/router` in external package for SolidStart

I'm trying to write a library for my SolidStart project & need to use the A component exported from @solidjs/router in the library. However, when I use the library in the app it breaks & complains that it needs to be wrapped in <Router>. If I copy paste the library code into the SolidStart project it suddenly works flawlessly. Does anyone know what's going on? For context, I'm trying to create a builder function that returns a wrapped A component, like so:
import { createNavigationInLibrary} from "my-library"
const { A } = createNavigationInLibrary();
import { createNavigationInLibrary} from "my-library"
const { A } = createNavigationInLibrary();
Edit: Some additional context - @solidjs/router is a peerDependency in the library, so it should be using the same version
6 Replies
foolswisdom
foolswisdom9mo ago
Is solidjs itself a dep or peer dep (it needs to be a peer dep)?
Loris Sigrist
Loris SigristOP9mo ago
Also a peerDependency
Loris Sigrist
Loris SigristOP9mo ago
These are the packages used in the library
No description
foolswisdom
foolswisdom9mo ago
npm list solid-js is a good way to verify you only have a single copy of solid I don't have any other ideas of what might be wrong
Loris Sigrist
Loris SigristOP9mo ago
That's it, thank you! It seems like the library is using router v 0.10 while the app is using 0.13. Not sure why the versions are different, but I'll figure it out
foolswisdom
foolswisdom9mo ago
Well, it looks like you specified 0.10.0 as a peer dep, and the ^ only treats minor versions as compatible post 1.0.0 So it considers 0.10 and 0.13 as incompatible libraries, rather than just bumping to the latest version. And as it happens, I think there were some big changes there
Want results from more Discord servers?
Add your server