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

9 messages · Page 1 of 1 (latest)

humble aurora
#

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();

Edit: Some additional context

  • @solidjs/router is a peerDependency in the library, so it should be using the same version
waxen mauve
#

Is solidjs itself a dep or peer dep (it needs to be a peer dep)?

humble aurora
#

Also a peerDependency

#

These are the packages used in the library

waxen mauve
#

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

humble aurora
#

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

#

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

waxen mauve
#

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