Skip to content

fix: inline Solid packages declared at the workspace root - #435

Merged
ryansolid merged 2 commits into
nextfrom
fix/157-workspace-root-solid-deps
Oct 21, 2026
Merged

ryansolid merged 2 commits into
nextfrom
fix/157-workspace-root-solid-deps

Conversation

@lxsmnsyc

Copy link
Copy Markdown
Member

Fixes #157 on next. The fix for main (1.x) is in a separate PR.

In a workspace, a Solid package declared only in the workspace root's package.json is now inlined. Before, Vitest left it external, Node loaded its raw .jsx files, and tests failed with Unknown file extension ".jsx".

Cause

  • vitefu's crawlFrameworkPkgs only reads the package.json at the Vite root.
  • npm and yarn workspaces hoist root dependencies, so a project can import packages its own package.json does not list.
  • Those packages never reached ssr.noExternal, which Vitest 4 and later uses to build its inline list.

Changes

  • When searchForWorkspaceRoot(root) differs from the project root, the plugin also crawls the workspace root's package.json.
  • Only the ssr.noExternal entries from that crawl are merged. optimizeDeps.include entries must resolve from the project root, so they are not added.
  • The change also applies to dev SSR and builds. Inlining a package that is never imported has no effect.

Testing

  • Reproduced with an npm workspace: a root vitest.config.ts with projects: ['modules/*'], and @solidjs/router declared only in the root package.json.
    • Vitest 5.0.5 failed with TypeError: Unknown file extension ".jsx" for .../@solidjs/router/dist/routers/...jsx.
    • With the fix, the test passes.
  • Added a vitest/workspace-root-pkgs check to examples/start-ssr/test/run.mjs. It resolves the config for a temporary workspace and fails without the fix.
  • pnpm test:unit and node test/run.mjs vitest pass. The full start-ssr browser suite was not completed locally.

🤖 Generated with Claude Code

- vitefu only crawled the package.json at the Vite root.
- In a workspace, a project can import packages that only the workspace root declares.
- Those packages were left external, so Vitest loaded their .jsx files with Node and failed with `Unknown file extension ".jsx"`.
- The plugin now also crawls the workspace root and adds its framework packages to `ssr.noExternal`.

Fixes #157

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4f2d418

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/vite-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/vite-plugin@435

commit: 4f2d418

…t-solid-deps

# Conflicts:
#	examples/start-ssr/test/run.mjs
@ryansolid
ryansolid merged commit 3715638 into next Oct 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants