Skip to content

fix(tests): handle unknown .jsx extension for TanStack solid dependencies (@ennajari)#7806

Open
ennajari wants to merge 1 commit intomonkeytypegame:masterfrom
ennajari:fix/vitest-tanstack-jsx-extension
Open

fix(tests): handle unknown .jsx extension for TanStack solid dependencies (@ennajari)#7806
ennajari wants to merge 1 commit intomonkeytypegame:masterfrom
ennajari:fix/vitest-tanstack-jsx-extension

Conversation

@ennajari
Copy link
Copy Markdown

@ennajari ennajari commented Apr 10, 2026

Summary

Fixes #7801

@tanstack/solid-store (and related @tanstack/solid-* packages) ship .jsx source files in their dist/source/ directory. When vitest tries to load these in a Node.js context, it throws:

TypeError: Unknown file extension ".jsx" for .../node_modules/@tanstack/solid-store/dist/source/index.jsx

Root cause: vitest loads these packages outside of Vite's transform pipeline, so vite-plugin-solid's JSX transform never runs on them.

Fix: Register all @tanstack/solid-* packages in two places:

  • deps.optimizer.web.include — pre-bundles them through Vite's pipeline (covers happy-dom / jsdom environments)
  • ssr.noExternal in the jsx project — ensures they are also bundled in the SSR-like Node.js module loading context used for .spec.tsx tests

Test plan

  • pnpm vitest run completes without Unknown file extension ".jsx" errors
  • Tests that import from @tanstack/solid-store or any @tanstack/solid-* package run correctly
  • Existing tests remain unaffected

…cies

@tanstack/solid-store and related packages ship .jsx source files.
Vitest cannot load these directly in Node.js without a JSX transform.

Add all @tanstack/solid-* packages to deps.optimizer.web.include so
Vite pre-bundles them through its transform pipeline (including
vite-plugin-solid), and to ssr.noExternal in the jsx project so they
are also bundled in the SSR-like Node.js module loading context.

Fixes monkeytypegame#7801
@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vitest crash: Unknown file extension ".jsx" for TanStack dependencies

2 participants