fix(dev): proxy content assets to cli server

The CLI content server serves the content directory at the URL root, so
images and other content assets are requested as root-relative paths
(e.g. /adventures/map.png). The dev proxy only forwarded /content, so
those requests fell through to historyApiFallback and the browser got
index.html instead of the asset.

Forward any request that maps to a real file under content/ to the CLI
server, keeping /static/ bundles on the web dev server.
This commit is contained in:
2026-09-13 14:24:29 +08:00
parent 12f8d8542c
commit e0e7250180
3 changed files with 65 additions and 11 deletions
+2 -1
View File
@@ -8,7 +8,8 @@
* Dev 工作流:运行 CLI 服务器并在 rsbuild 配置中设置代理
* > npm run tttk serve ./content
* > npm run dev
* rsbuild 会将 /__CONTENT_INDEX.json、/__COMPLETIONS.json、/__CONTENT_REGISTRY.json、/content/ 代理到 CLI 服务器
* rsbuild 会将 /__CONTENT_INDEX.json、/__COMPLETIONS.json、/__CONTENT_REGISTRY.json、
* /.ttrpg 以及内容目录中的静态资源代理到 CLI 服务器
*/
import {