devtools/packages/devtools-utils/src
Alem Tuzlak 024ea7d602
fix(devtools): prevent solid-js from leaking into server bundles (#367)
* fix(devtools): prevent solid-js from leaking into server bundles

Move all solid-js runtime imports (render, Portal, lazy, ClientEventBus)
from core into a new mount-impl.tsx file loaded via dynamic import().
This ensures solid-js code is never in the static import graph and only
loads as a separate chunk when mount() is called on the client.

* feat(devtools-utils): add Solid.js support and enhance routing configurations

* ci: apply automated fixes

* fix(devtools-utils): resolve self-referencing import for clean CI builds

Add ambient module declaration (barrel-types.d.ts) so TypeScript can
resolve @tanstack/devtools-utils/solid on clean checkouts without dist/.

* ci: apply automated fixes

* fix(devtools-utils): fix lint errors in solid class files

* fix(devtools-utils): use variable import path to prevent esbuild SSR pre-bundling

esbuild follows dynamic imports with string literals during Vite's
dependency optimization, pulling solid-js into the SSR bundle. Using a
variable path prevents static analysis from following the import.

* fix(devtools-utils): add workerd export condition to ./solid for Cloudflare SSR

The ./solid export was missing a workerd condition, causing Vite's SSR
dep optimizer (esbuild) to resolve to the client entry instead of
server.js when running under Cloudflare workerd. The client entry's
compiled Solid JSX imports use/setStyleProperty from solid-js/web which
don't exist in the server entry, crashing the dev server.

Also reverts the variable import workaround in class.ts back to a
literal import, since the workerd condition now properly routes SSR
resolution to the server entry.

* Refactor code structure for improved readability and maintainability

* fix(devtools-utils): use relative dynamic import for class-mount-impl

Replace the cross-package bare specifier import('@tanstack/devtools-utils/solid')
with a relative import('./class-mount-impl'). Bare specifiers in dynamic imports
inside pre-bundled dependencies aren't resolved by bundlers like esbuild/webpack,
causing "Failed to resolve module specifier" errors in the browser.

The relative import works in all bundlers (Vite, Next.js, etc.) because the
class-mount-impl.js file is co-located in the same dist directory, built
together via a single vite config with vite-plugin-solid for JSX compilation.

* ci: apply automated fixes

* chore: fix issues

* chore: changeset

* fix: lock

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
History 2026-03-06 13:24:54 +01:00
..
preact chore: fix panel double mounting (#310) 2026-01-08 15:00:36 +01:00
react chore: fix panel double mounting (#310) 2026-01-08 15:00:36 +01:00
solid fix(devtools): prevent solid-js from leaking into server bundles (#367) 2026-03-06 13:24:54 +01:00
vue feat: vue devtools (#226) 2025-11-25 12:32:50 +01:00