Skip to content

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

Open
lxsmnsyc wants to merge 1 commit into
mainfrom
fix/157-workspace-root-solid-deps-main
Open

lxsmnsyc wants to merge 1 commit into
mainfrom
fix/157-workspace-root-solid-deps-main

Conversation

@lxsmnsyc

Copy link
Copy Markdown
Member

Fixes #157 on main (1.x). The fix for next 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 examples/vite-6/tests/workspace-root.mjs, run as part of the vite-6 test script. It resolves the config for a temporary workspace and fails without the fix.
  • tsc --noEmit passes. The vite-6 browser suite was not run locally, because Playwright's browser is not installed.

🤖 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: c750c34

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

This PR includes changesets to release 1 package
Name Type
vite-plugin-solid 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/vite-plugin-solid@436

commit: c750c34

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.

Vitest fails with TypeError: Unknown file extension ".jsx"

1 participant