Catch-all route chunks are named `_...404_-<hash>.js`; the `..` trips path-traversal guards and breaks the lazy preload
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 68/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript, vite
- 領域
- build-system, tooling
研究方向
Start by reading the client-build configuration in src/index.ts (config and configEnvironment) and src/ssr/index.ts. Reproduce with the linked solid-v2/fullstack example and inspect the production chunk name for [...404].tsx. Done means client route chunk names no longer contain path-traversal-like dot runs, while a user-supplied sanitizeFileName is preserved.
由索引模型根據 Issue 內容生成。
描述
Summary
A catch-all route file such as [...404].tsx builds to a client chunk named _...404_-<hash>.js. Any server, static host, CDN or WAF whose path-traversal guard rejects URLs containing .. refuses that chunk. The lazy route's module preload then fails, and hydration of that route breaks:
- Without a
<Loading>boundary: the document-root fallback dies withHydration Mismatch, and the page is dead. - With one: the boundary re-imports the chunk, fails again, and the root is replaced by the entry's error UI.
Every [...rest] route is affected, deterministically, in production.
This was split out of solidjs/solid#3338, where it came up as a second, deterministic cause of the reporter's dead-page symptom.
Reproduction
From the reproduction on solidjs/solid#3338: the solid-v2/fullstack template (solid-js / @solidjs/web 2.0.0-rc.6, @solidjs/router 2.0.0-next.21, @solidjs/vite-plugin 3.0.0-next.39), with the fileRoutes() catch-all [...404].tsx, as a production build served by the template's server.js:
$ curl -i http://localhost:3000/assets/_...404_-BW0HgTxD.js
HTTP/1.1 404 Not Found
content-type: text/html; charset=utf-8
The template's server.js refuses any URL containing .., so the chunk request falls through to SSR and comes back as the 404 HTML page. The guard is being fixed in the template separately (resolved-path containment instead of a substring check). But substring .. checks are common in hosts and middleware the plugin doesn't control, so the chunk name itself shouldn't contain ...
For reference, the plugin's own start.node server (src/node-entry/index.ts, staticFile) only rejects path segments that start with ., so it serves this file. The failure shows up behind other guards.
Expected behavior
Client chunk file names emitted for route modules never contain .. (or other dot runs that read as path traversal). For example, [...404].tsx → _404_-<hash>.js or 404-<hash>.js. Hashing keeps the names unique.
Where it likely lives
The plugin doesn't set chunkFileNames or sanitizeFileName for the client build, so the chunk name is the bundler default ([name]-[hash].js). [name] comes from the facade module's file name. As observed above, the default naming turns [...404] into _...404_: the brackets are replaced and the dots are kept. A fix would be a client-build output.sanitizeFileName (or a chunkFileNames function) that collapses dot runs. It belongs where the plugin configures the client environment's build: the config / configEnvironment hooks in src/index.ts, and the Start client build config in src/ssr/index.ts. It should compose with a user-supplied sanitizeFileName rather than overwrite it.
Filed on behalf of @ryansolid. — Claude via Cursor
- 主要語言
- TypeScript
- 星號
- 523
- 分支
- 74
- 平均合併
- 1 天 18 小時
- 30 天內合併 PR
- 53
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
solidjs/solid-vite-plugin 的其他 Issue
-
Vitest config is dropped when test.server.deps.external already lists solid-js可能已有人在做 @RaphaelFakhri 於 8 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
solidjs/solid-vite-plugin#454 ·
維護者通常 1 天內回覆
-
Test environment detection doesn't consider Vitest workspaces可能已有人在做 @carloitaben 於 65 天前認領。 未關閉1.x
難度 2/5 1-3 小時 新手友好度 78/100
solidjs/solid-vite-plugin#205 · 1 則留言 · 2 個 reaction ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 70/100
solidjs/solid-vite-plugin#467 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 56/100
solidjs/solid-vite-plugin#456 · 3 則留言 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 35/100
solidjs/solid-vite-plugin#328 ·
維護者通常 1 天內回覆
查看 solidjs/solid-vite-plugin 的全部 Issue
相似的 Issue
-
e2e-failure ready-to-code
難度 2/5 1-3 小時 新手友好度 79/100
redhat-developer/rhdh-plugin-export-overlays#4580 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
devdotfast/whiteboard#1415 · 1 則留言 ·
維護者通常 1 天內回覆
-
area/sessions comp/desktop desktop/sessions P2 type/bug
難度 2/5 1-3 小時 新手友好度 84/100
NousResearch/hermes-agent#145383 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
enhancement p2 setup
難度 1/5 1 小時以內 新手友好度 88/100
維護者通常 1 天內回覆