solidjs

solid-vite-plugin

A simple integration to run solid-js with vite

by solidjs

TypeScript

TypeScript87.3%
JavaScript12.2%
HTML0.4%
MDX0.1%

Commit activity

Last 12 weeks · 51 commits

Full graph →

Community health

3 of 6 standards met

Community profile →
62
✓README○License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Active · 1 in progress · Last activity 8h ago
See all on GitHub →
brenelz

Fixes #537. In start mode dev, after an edit to a module that a lazy route imports, the server render kept serving the old module until the dev server restarted. This happened with runners that rely on 's handshake instead of a full reload, such as workerd under . Root cause The dev asset resolver's style walk transforms SSR modules to read their imports, which stores on the module graph. Vite's answers a runner's request with whenever a exists. When the walk re-transformed an invalidated module before the runner imported it again, the runner was told to keep its old copy. Change now wraps on each server environment when the resolver is created. For every runner fetch that returns code, the wrapper records the module's invalidation timestamp. When a later cached request gets but the module has been invalidated since the runner received its code, the wrapper sends fresh code with . The walk calls the unwrapped , so its transforms no longer change what the runner is told. I did not use the approaches discussed in the issue: Clearing the walk's after the walk races the runner's own imports and evaluates a module twice. The new race test fails with that change in all three runs I made. Comparing the transform result object the runner received with the current one also double-evaluates, because the walk requests a module by absolute path and the runner by . Vite does not dedupe those two requests, so the second result replaces the first. The wrapper compares invalidation timestamps instead, and treats code equal to the stored result as current. Every runner fetch now does one module-graph lookup first. For a URL not yet in the graph, that includes one extra call. A module the runner fetched before the wrapper was installed keeps Vite's normal answer. Verification uses to stand in for workerd, with a slow transform to widen the race window. It covers CSS inlining, the stale module after an edit, and single evaluation when the walk races the first render and a render after an edit. The stale test fails on . : 152 tests pass. and the build are clean. : (783 assertions, with set to Playwright's Chrome for Testing) and the , , and scripts pass. Open I have not run the issue's Cloudflare repro. overrides on its prototype and uses 's invoke handler, so the instance wrapper sits in front of it, but this has not been run in workerd. The walk still writes to the shared server graph. A walk that does not touch the runner's state, such as one using a separate non-runnable environment, would remove the hazard without wrapping . 🤖 Generated with Claude Code

brenelz · 8h ago
ethan-huo

Summary In start mode dev, after editing a module that a lazily rendered route imports, the server render keeps serving the old module until the dev server restarts. The client gets the new code, so the page shows stale markup and classes (and hydration can mismatch when the structure changed). Modules on the entry's static path (imported from ) update normally. Cause The dev asset resolver's style walk ( in ) calls and on the SSR environment. Both write into that environment's module graph. Vite's module runner decides whether its evaluated copy is current from alone. In , ; otherwise it returns (fetchModule.ts). After a file change, Vite clears on the changed module and its importers. That is the only signal the runner has to re-evaluate them. Rendering a lazy route calls . The watcher event has just cleared the resolver's cache (), so the resolver walks the route's graph again. The walk re-transforms the invalidated modules before the runner imports them. The runner then asks with , gets , and keeps its old evaluated module. Nothing clears it after that, so the result is stale until the server restarts. An unchanged importer re-evaluates around it but still holds the old exports. The code is the same at (the latest on npm) and on . Reproduction Versions: , /, Vite 8 (Vite+ 1.5.1 core), owning the environment (workerd module runner). Start mode with and filesystem routes as . 1. Start dev and (route renders `components/principles.tsxprinciples.tsx(ssr) hmr update virtual:cloudflare/worker-entrycurl //virtual:stylex.cssapp.tsxcollectDevStyleSourcestransformResultprinciples.tsxtransformResultfetchModuleinvalidate: truecachedtransformRequest` on a runnable environment can cause this. I'm filing it here because this walk is what triggers it during every lazy render after an edit.

ethan-huo · 18h ago
kylemichaelreaves

Summary Since 2.11.15, a test file that opts into gets solid-js's server build when the config's is or . In that file is and never runs. 2.11.14 works. Reproduction : : Versions: vite-plugin-solid 2.11.15, solid-js 1.9.18, vite 8.3.6, vitest 5.1.0, happy-dom 21.0.4, Node 22.23.2. Where it seems to come from In 2.11.15, is computed from the config-level environment (). then skips for the environment: Vitest runs files that declare in the environment. The plugin can't see that per-file override at config time, so those files resolve solid-js without and land on the server build. In a larger suite (~170 files, 41 of them node-env) we also saw DOM-environment files fail intermittently, but only when they ran alongside node-env files. Alone they all passed, and the failure count changed from run to run. I haven't isolated that part, so treat it as an observation, not a diagnosis. Workaround Putting back on the environment makes the reproduction pass: This brings back the trade-off the 2.11.15 change was avoiding, where a Node-only package whose export is (the case) fails to load. A fix inside the plugin would need to keep both working, for example by keeping on unless the user opts out, or by offering an option for suites that mix per-file environments.

kylemichaelreaves · 3d ago
brenelz

Fixes #534. Since 2.11.15, a test file with loads the server build of solid-js when is or . In that file is and effects never run. Root cause The fix for #125 (765a406) removed the condition from the whole environment in DOM test runs, so that Node would not get in its . But Vitest runs per-file environment files in the environment, and solid-js is inlined there, so Vite resolved it without and picked the server build. Vitest builds Node's from the resolved (Vitest 3 and 5 both read it). Vite 6, 7 and 8 fill that field from a separate copy of the environment's conditions, and Vite does not read it again after resolving. Change adds to the environment in test mode again, as 2.11.14 did. It is no longer added a second time when the list already has it. In DOM test runs, removes from only, which is the list Vitest passes to Node. The environment keeps it. A condition the user set on is left in place, and nothing changes if that field turns out to be the same object as the environment's. Node-env files then load the client build of solid-js, and still loads in both node and DOM files. Verification The reporter's setup (vite 8.3.6, vitest 5.1.0, happy-dom 21.0.4, solid-js 1.9.18), with node-env and DOM files plus imports in each, run against the packed plugin: A mixed suite of 25 DOM files and 25 node-env files passes three runs out of three, with and without . On 2.11.15 only the node-env files failed. I could not reproduce the intermittent DOM-file failures described in the issue. New tests, which fail without the fix: , a file in the jsdom suite (). Three cases in (, 17/17 pass). , updated: the environment keeps and Node's conditions do not. The browser-mode example suite did not run locally because the Playwright browser was missing. It runs in the environment, which this change does not touch. Open The plugin keeps its test-mode flags on the plugin instance across , and . If two config resolutions run at once on one instance they can read each other's flags. The flag from 2.11.15 already had this, and this PR does not change it. 🤖 Generated with Claude Code

brenelz · 3d ago
bigtechricchie

Summary Would the maintainers consider supporting a native-only installation of that does not require installing or ? This request concerns the installed dependency graph, not whether Babel transforms application code when the native compiler is selected. Current behaviour With and , our representative SolidJS 2 TSX fixture compiles successfully without loading Babel modules. The upstream lazy-loading improvement appears to have resolved the previous eager-loading behaviour. Thank you for that change. However, the plugin still declares these regular dependencies: Package managers therefore install Babel and its transitive dependencies even for native-only projects. Reproduction Tested environment: Node.js 24.20.0 pnpm 12.15.0 Windows Vite configuration: Our lockfile still contains Babel packages as dependencies of the Vite plugin. We also tested compilation with a Node.js module-resolution hook that rejects Babel imports: 1. With plugin , Vite configuration loading failed when was blocked. 2. With plugin , the native TSX fixture compiled successfully with the same blocker enabled. 3. Local verification and GitHub Actions passed. Reproduction and supporting technical evidence: https://github.com/bigtechricchie/solidjs-monorepo-starter/pull/6 These tests cover the representative native compilation path, not every possible development, SSR or custom Babel configuration. Proposed improvement Provide an officially supported way to install and use the native compiler without Babel-related packages, while preserving the existing Babel compiler option. Possible approaches include: Making Babel packages optional peer dependencies, with explicit installation instructions for Babel mode. Providing a separate optional Babel integration package. The preferred approach should account for package managers that automatically install peer dependencies. Ideally, regression tests would cover native compilation without Babel installed, Babel-mode compilation with dependencies installed, and a clear error when Babel mode is selected without the required packages. Motivation Reducing unnecessary dependencies can improve installation size, dependency maintenance and software supply-chain hygiene. This is a dependency-minimisation proposal, not a report of a security vulnerability. Would the maintainers be open to a native-only installation mode, and which packaging approach would they prefer?

bigtechricchie · 1w ago
Structured data for AI agents

Repository: solidjs/solid-vite-plugin. Description: A simple integration to run solid-js with vite Stars: 524, Forks: 71. Primary language: TypeScript. Languages: TypeScript (87.3%), JavaScript (12.2%), HTML (0.4%), MDX (0.1%). Latest release: vite-plugin-solid@2.11.16 (3d ago). Open PRs: 1, open issues: 2. Last activity: 8h ago. Community health: 62%. Top contributors: amoutonbrady, ryansolid, birkskyum, lxsmnsyc, claude, github-actions[bot], dependabot[bot], alexandre-mb-airweb, bluwy, brenelz and others.