You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you see in the image, Astro loads two copies of SolidJS, one through the file:/// URL (see createResource), the other with the POSIX path (see createMemo).
Based on what I know with Vite's module resolution, since this is close to the browser behavior, two copies are loaded because they come from different URLs, despite pointing to the same file locally. This behavior breaks SolidJS packages that uses SolidJS APIs that relies on the existence of a root (e.g. createUniqueId, createResource). The code basically thinks that the APIs are called "outside a root".
I do think this same issue might be prevalent to other integrations that rely on the same mechanism (e.g. React), but I don't have any evidence for that yet.
What version of
astro
are you using?2.1.8
Are you using an SSR adapter? If so, which one?
None (if @astrojs/node doesn't count)
What package manager are you using?
pnpm
What operating system are you using?
Windows
What browser are you using?
Chrome
Describe the Bug
As you see in the image, Astro loads two copies of SolidJS, one through the
file:///
URL (seecreateResource
), the other with the POSIX path (seecreateMemo
).Based on what I know with Vite's module resolution, since this is close to the browser behavior, two copies are loaded because they come from different URLs, despite pointing to the same file locally. This behavior breaks SolidJS packages that uses SolidJS APIs that relies on the existence of a root (e.g.
createUniqueId
,createResource
). The code basically thinks that the APIs are called "outside a root".I do think this same issue might be prevalent to other integrations that rely on the same mechanism (e.g. React), but I don't have any evidence for that yet.
Another potential issue is how
@astrojs/solid-js
has SolidJS as both a peer dependency and a dependency, I do think it should be both a peer and a dev dependency?Link to Minimal Reproducible Example
https://github.com/lxsmnsyc/astro-solid-spa-nested
Participation
The text was updated successfully, but these errors were encountered: