Skip to content

Weird bug when using monorepo #2538

Closed
Closed

Description

@floratmin

Describe the bug

I am using a monorepo and have a problem importing components into my application. Up until solid-js v1.9.5 everything worked fine in my repository. But whenever I upgrade to a newer version I get the following error:

index.jsx:17 Error: <A> and 'use' router primitives can be only used inside a Route.

However when I created a minimal reproduction of the error, all of a sudden it started to work with solid-js v1.9.9 and the error shows when I use solid-js v1.9.5 and use pnpm page-direct-import dev.

But in my monorepo the direct import and exports import both work fine with v1.9.5 and both break with v1.9.9.

Your Example Website or App

https://github.com/floratmin/solid-monorepo-route-breaks

Steps to Reproduce the Bug or Issue

Minimal reproduction

  1. pnpm i
  2. pnpm page-direct-import dev
  3. Open page and click on about link
  4. The error gets displayed
  5. Change solid-js version to v1.9.9 in all package.json of apps packages
  6. pnpm i
  7. pnpm page-direct-import dev / pnpm page-exports-import dev / pnpm page
  8. Open page and click on about link
  9. Everything works

My monorepo (both direct import and exports import)

  1. Solid-js version is v1.9.5
  2. pnpm page dev
  3. everything works
  4. Change solid-js version to v1.9.9 in all package.json of apps packages
  5. pnpm i
  6. pnpm page dev
  7. Open page and click on about link
  8. The error gets displayed

Expected behavior

Routing should not loose context

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux] Ubuntu
  • Browser: [e.g. Chrome, Safari, Firefox] Chrome
  • Version: [e.g. 91.1]

Additional context

This issue seems related

Activity

  1. brenelz commented on Apr 30, 2026

    @brenelz
    Contributor

    Upon looking at this I believe this is a duplicate-solid-js resolution problem in the monorepo.

    Two distinct solid-js instances are present in node_modules:

    • solid-js@1.9.5 — pulled by the apps/page-direct-import workspace (matches package.json override)
    • solid-js@1.9.9 — pulled in transitively, used by @solidjs/router instance loaded from libs/app/components-direct-import
  2. ryansolid commented on Apr 30, 2026

    @ryansolid
    Member

    Yeah the linked issue was double package as well. These setups can be tricky but there is nothing really on the Solid side to fix since this is clearly package resolution concern. @floratmin sorry for not getting to this earlier. Thank you @brenelz for taking the time to download and look at the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions