serverFunctions.components (dev): server-functions client is duplicated when @solidjs/web is in optimizeDeps.exclude, so post-boot server components resolve to undefined
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 58/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript, vite
- Domínio
- build-system, devtools
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 522
- Forks
- 73
- Merge médio
- 1d 4h
- PRs com merge (30d)
- 35
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de solidjs/solid-vite-plugin
-
Test environment detection doesn't consider Vitest workspacesTalvez já em andamento @carloitaben assumiu há 57 dias. Aberta1.x
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
solidjs/solid-vite-plugin#205 · 1 comentário · 2 reações ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 58/100
solidjs/solid-vite-plugin#427 ·
Mantenedores costumam responder em até 1 dia
-
Dev: a stylesheet shared by the entry and a lazy component moves after the lazy component's stylesAberta
Dificuldade 3/5 Meio dia Facilidade para iniciantes 62/100
solidjs/solid-vite-plugin#425 ·
Mantenedores costumam responder em até 1 dia
-
[3.0.0-next.50 / next] SSR build: the $$moduleUrl export added to a Worker main module stops workerd from startingTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 3/5 Meio dia Facilidade para iniciantes 55/100
solidjs/solid-vite-plugin#420 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
solidjs/solid-vite-plugin#419 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de solidjs/solid-vite-plugin
Issues semelhantes
-
Admin search throws for permissions added through Admin.generalIndexItems('permissions', ...)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Koenkk/zigbee-herdsman-converters#13540 ·
Mantenedores costumam responder em até 1 dia
-
Add: Tequila Music TV RO SDAbertacheck:passed streams:add
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
iptv-org/iptv#55821 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
area/busola/ux
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
kyma-project/busola#5442 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
vercel-labs/wterm#246 ·
Mantenedores costumam responder em até 1 dia