fix(devtools): prevent solid-js from leaking into server bundles#367
Open
AlemTuzlak wants to merge 1 commit intomainfrom
Open
fix(devtools): prevent solid-js from leaking into server bundles#367AlemTuzlak wants to merge 1 commit intomainfrom
AlemTuzlak wants to merge 1 commit intomainfrom
Conversation
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.
|
|
View your CI Pipeline Execution ↗ for commit 07753f3
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/devtools
@tanstack/devtools-client
@tanstack/devtools-ui
@tanstack/devtools-utils
@tanstack/devtools-vite
@tanstack/devtools-event-bus
@tanstack/devtools-event-client
@tanstack/preact-devtools
@tanstack/react-devtools
@tanstack/solid-devtools
@tanstack/vue-devtools
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
render,Portal,lazy,ClientEventBus) fromcore.tsxinto a newmount-impl.tsxfilecore.tsnow usesimport('./mount-impl')insidemount()so solid-js is never in the static import graphserver.js,index.js,dev.js) are now completely free of solid-js references — solid code only loads as a separate chunk whenmount()is called on the clientProblem
When using
@tanstack/react-devtools(or any non-Solid adapter) in SSR environments like Cloudflare workerd, solid-js code leaked into the server bundle through the static import graph of@tanstack/devtools, causing runtime crashes.Test Plan
dist/server.jsanddist/index.jscontain zero solid-js referencesexamples/react/bundling-reprobuilds successfully with zero solid-js in the server bundle