S
SolidJS3y ago
seb

Including solidjs router creates multiple instances of solid

I'm trying to add @solidjs/router to a project. But as soon as I import it and add the minimal setup, I get the following warning in my browser console:
You appear to have multiple instances of Solid. This can lead to unexpected behavior.
You appear to have multiple instances of Solid. This can lead to unexpected behavior.
Removing @solidjs/router resolves the issue. My imports look like this:
import { Component } from 'solid-js';
import { render } from 'solid-js/web';
import { A, Routes, Route, Router } from '@solidjs/router';
import { Component } from 'solid-js';
import { render } from 'solid-js/web';
import { A, Routes, Route, Router } from '@solidjs/router';
I had a hunch it was a peer-dependency issue, since @solidjs/router specifies solidjs@1.5.3 while I had solidjs@1.6.5 installed, but downgrading to 1.5.3 didn't end up fixing this issue. Also relevant to note that I'm using vite with vite-plugin-solid and pnpm. Any idea what I could be doing wrong here?
4 Replies
ryansolid
ryansolid3y ago
Which package manager are you using. The router should have a ^ which means it should match against 1.6 versions with clean install, no locks etc.. I haven't seen this be a problem. I wonder.. are you using Vite 4. If so, upgrade to the latest. It was causing this too recently.
seb
sebOP3y ago
I was using vite@4.0.1 and pnpm@7.6.0. I've upgraded to vite@4.0.3, and that seems to have fixed the issue. Thank you!
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
ryansolid
ryansolid3y ago
Yeah Vite 4.0.1 had a bug where it caused module duplication breaking a whole bunch of stuff.

Did you find this page helpful?