[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
foolswisdom3mo ago
Is solidjs itself a dep or peer dep (it needs to be a peer dep)?
Loris Sigrist
Loris Sigrist3mo ago
Also a peerDependency
Loris Sigrist
Loris Sigrist3mo ago
These are the packages used in the library
No description
foolswisdom
foolswisdom3mo 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 Sigrist3mo 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
foolswisdom3mo 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
More Posts
Seems like I found a JSX bugAs long I know, you can add up variables and raw text inside a tag, something like: `<p>{myVar} peopHow can I protect nothing ever breaks, while the setTimeout is waiting```tsx createEffect(() => { if (puzzle_lala().is_revealed && is_jump_to_next_puzzle_immeCanonical way to handle exceptions in async functions to perform redirect?Hi folks, I'm very new to solid and frontend development hence my question. I have a class that talk[solved]Issue with Solid Start MDX Project: 404 Error for New PageHello, I have created a Solid Start project using the “with MDX” mode. By default, the navigation inTrying SolidJS + Deno + ViteJS + Solid-Router + TailwindCSS, would love some help :)Hello, all 😄 I'm trying to run SolidJS with Deno & ViteJS, thus I'm using a new plugin made by commHow to css preloadingWhen the file weighs a lot, I don’t immediately see the application of styles on the site. I connecHandling of sensitive information from the front endHello, I am new in front end, now I am trying to make some components, that are shown/hidden dependiResource with async cacheWhats the pattern for using resources with caching that may be async? What I mean by that is that myGetting this error - TypeError: Cannot read properties of null (reading '_isDirty')Hi all! I am trying to create a simple home page using lighting Solid JS something like a netflix pDerived signals with args?Docs says that we can create derived signals with functions like this: ```ts const double = () => 2