serverFunctions.components (dev): server-functions client is duplicated when @solidjs/web is in optimizeDeps.exclude, so post-boot server components resolve to undefined
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript, vite
- Ambito
- build-system, devtools
Direzione di ricerca
Start with the command === 'serve' && serverComponents dependency entry in src/index.ts, then trace how @solidjs/web/frames and compiled function references resolve their server-functions client imports when @solidjs/web is excluded from optimizeDeps. Reproduce using the supplied Vite config and click sequence; the issue is done when the dynamically mounted panel renders with the exclusion enabled and the existing no-exclusion and build-preview behavior still works.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Versions: [email protected], @solidjs/[email protected], @solidjs/[email protected], [email protected] (first seen on rc.10 / next.46).
Repro
// vite.config.ts
export default defineConfig({
optimizeDeps: { exclude: ['@solidjs/web'] },
plugins: [solid({ ssr: true, start: { app: 'src/App.tsx' }, serverFunctions: { components: true } })],
})
// src/server.tsx
'use server'
export async function getPanel() {
return () => <section id="panel">server panel</section>
}
// src/App.tsx
export default function App() {
const [page, setPage] = createSignal('a')
const Panel = dynamic(() => getPanel())
return (
<>
<button id="go-b" onClick={() => setPage('b')}>go b</button>
{page() === 'a' ? <p id="page-a">page a</p> : <Loading><Panel /></Loading>}
</>
)
}
Run vite dev, load /, then click #go-b. The boundary is not in the document, so it mounts after boot.
Expected: the panel mounts, as it does without the exclude.
Actual: POST /_server/data/getPanel-… returns 200 application/x-frame-stream with the right chunks, but the call resolves to undefined and nothing mounts. A document-SSR'd (adopted) boundary still works, and vite build + vite preview work too.
Cause
With serverComponents, the plugin force-includes @solidjs/web/frames and @solidjs/web/server-functions (src/index.ts, the command === 'serve' && serverComponents entry) so that both share one instance of the transport config module. But @solidjs/web/frames imports @solidjs/web/server-functions/client. When the app excludes @solidjs/web, that subpath is neither included nor resolved to the optimized module:
node_modules/.vite/deps/@solidjs_web_frames.js→import … from "@solidjs/web/server-functions/client", which loads the raw node_modules file.- Compiled function references →
@solidjs/web/server-functions, which loads@solidjs_web_server-functions.js.
That gives two instances of the server-functions client. installServerComponents() calls configureServerFunctionsClient({ responseHandler }) on one of them, while the references call the other, which has no handler. The frame-stream response is therefore decoded as plain data.
Without the exclude, the frames bundle imports ./@solidjs_web_server-functions.js and everything shares one instance. Excluding @solidjs/web is common in apps that pin or link Solid.
Workaround
optimizeDeps: { exclude: ['@solidjs/web'], include: ['@solidjs/web/server-functions/client'] }
Suggested fix
When command === 'serve' && serverComponents, also force-include @solidjs/web/server-functions/client. Alternatively, have frames import the same specifier the references use.
- Lingua principale
- TypeScript
- Stelle
- 522
- Fork
- 73
- Merge medio
- 1g 4h
- PR unite (30g)
- 35
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di solidjs/solid-vite-plugin
-
Test environment detection doesn't consider Vitest workspacesForse già presa @carloitaben l’ha presa 57 giorni fa. Aperta1.x
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
solidjs/solid-vite-plugin#205 · 1 commento · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
solidjs/solid-vite-plugin#427 ·
I maintainer di solito rispondono entro 1 giorno
-
Dev: a stylesheet shared by the entry and a lazy component moves after the lazy component's stylesAperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 62/100
solidjs/solid-vite-plugin#425 ·
I maintainer di solito rispondono entro 1 giorno
-
[3.0.0-next.50 / next] SSR build: the $$moduleUrl export added to a Worker main module stops workerd from startingForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
solidjs/solid-vite-plugin#420 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
solidjs/solid-vite-plugin#419 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di solidjs/solid-vite-plugin
Issue simili
-
Unsampled pageload span is profiled when profileLifecycle is 'trace' (browser UI profiling)Forse già presa @Jxxunnn l’ha presa oggi. ApertaBrowser Waiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
getsentry/sentry-javascript#25497 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
e2e-failure ready-to-code
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
redhat-developer/rhdh-plugin-export-overlays#4438 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area: core
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
angular/angular#71422 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
facebook/docusaurus#12739 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Difficoltà 1/5 1-3 ore Idoneità per principianti 68/100
vercel/ai#23537 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno