@void/react: a non-island component under an _-prefixed directory in pages/ ships every page module to the browser
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #603 来自 @dvkam —— 已合并
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 72/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- react, typescript, vite
- 领域
- backend, build-system
调研方向
Read packages/react/src/plugin-pages.ts and compare its hasNonIslandPages() path handling with the scanner in scan.ts; the report says the Solid plugin has the same check. Reproduce with the provided _ui/frame.tsx example and inspect dist/client/assets after vp build. Done when files below underscore-prefixed directories are excluded from client bundles, with a regression test covering the case.
由索引模型根据 Issue 内容生成。
描述
Version: void / @void/react 1.2.1 (also 1.1.12); main at a6de7829.
Repro
pnpm create void(React, static output:output: 'static'invoid.config.ts).pages/index.island.tsx:import { Frame } from './_ui/frame'; export default function Home() { return <Frame><h1>Hello</h1></Frame>; }pages/_ui/frame.tsx, a shared server-only component that is not a page or an island:export const SECRET_COPY = 'server-only text'; export function Frame({ children }: { children: React.ReactNode }) { return <main data-x={SECRET_COPY}>{children}</main>; }vp build, thenls dist/client/assetsandgrep -l 'server-only text' dist/client/assets/*.js.
Expected: an island-only app emits no pages-client bundle, and frame.tsx (not a route, because the route scanner skips _ segments) never reaches dist/client.
Actual: pages-client-*.js plus a chunk for every page module and every import (frame-*.js) are emitted to dist/client/assets, and the server-only strings are in them. In our app that is 18 files and 351 KB instead of 5 files and 33 KB, and 42 strings that were meant to stay server-side.
Cause: packages/react/src/plugin-pages.ts hasNonIslandPages() skips only basenames that start with _:
if (name.startsWith('_') || name.startsWith('layout.')) continue;
entry.name for pages/_ui/frame.tsx is frame.tsx. The pages scanner (scan.ts) skips any segment that starts with _ (except _layouts), so the two disagree. The Solid plugin has the same check.
Suggested fix: test every path segment relative to dir, as the scanner does:
const rel = relative(dir, join(entry.parentPath, name));
if (rel.split(sep).some((s) => s.startsWith('_')) || name.startsWith('layout.')) continue;
This is adjacent to #559, which adds the .server. exclusion to the same line.
- 主要语言
- TypeScript
- 星标
- 580
- 派生
- 56
- 平均合并
- 11 小时 23 分钟
- 30 天内合并 PR
- 153
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
voidzero-dev/void 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 48/100
voidzero-dev/void#627 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
voidzero-dev/void#619 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
voidzero-dev/void#606 ·
维护者通常 1 天内回复
-
@void/react: client environment has no optimizeDeps.entries for pages, causing a dev re-optimization reload on first load可能已有人在做 @0froq 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 66/100
voidzero-dev/void#599 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
`void/log`: add `logger.child(fields)` to bind fields to every line可能已有人在做 @Dazzanova 于 1 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 82/100
voidzero-dev/void#596 · 1 条评论 ·
维护者通常 1 天内回复
查看 voidzero-dev/void 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
scaleway/ultraviolet#7089 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
tencent-connect/dsh-qqbot#81 ·
维护者通常 1 天内回复
-
[Bug]: Pen taps on sidebar rows start a drag and lose their click可能已有人在做 @makhnatkin 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
clangd/vscode-clangd#1009 ·