fix(tests): handle unknown .jsx extension for TanStack solid dependencies (@ennajari)#7806
fix(tests): handle unknown .jsx extension for TanStack solid dependencies (@ennajari)#7806ennajari wants to merge 5 commits intomonkeytypegame:masterfrom
Conversation
…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
|
hi @ennajari , did you test that really? cuz that doesn't seem like the full fix |
|
btw @fehmer has assigned it to himself, so he may want to look at it himself, i think you should have asked before the PR |
|
i don't mind somebody else fixing it, I haven't started working on it yet. @byseif21 could you provide the test-case to reproduce the problem? |
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
sure, here import { test, expect } from "vitest";
import { createHotkey } from "@tanstack/solid-hotkeys";
test("triggers jsx crash", () => {
expect(createHotkey).toBeDefined();
});try as a new test file (e.g |
|
thanks @byseif21 , shouldn't the test be named Just adding the regex to the |
hmm the thing is, wouldn't naming tests as .tsx be a bit inconsistent if they don't actually have UI components? I thought it was better to keep logic tests as .ts (like the ones in tests like for the hotkeys one when we add it, it will be only logic test and if it'll be as ts as i think, importing e.g |
|
Agreed with @byseif21. The repro imports from Current PR already applies the regex to all three projects via a shared constant, so the repro should pass as-is. Happy to narrow it down if you prefer a different split. |
Fixes #7801
@tanstack/solid-*packages ship.jsxsource files that Node.js cannot load without a JSX transform.Fix: Add
ssr.noExternal: ["@solidjs/meta", /@tanstack\/solid-.*/]to all three test projects (unit, jsdom, jsx). This forces Vite to bundle and transform them throughvite-plugin-solid.Test plan
@tanstack/solid-*packages run correctly