[Bug]: Web build fails when the checkout path contains a space (fonts-cjk alias keeps %20)

未关闭 适合新手
#29,587 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
nodejs, typescript
领域
build-system

调研方向

错误的路径来自 apps/web/vite.config.ts 中的 @betteroffice/fonts-cjk 别名,该别名用 new URL(...).pathname 构建其路径。复现方法是克隆到一个名称包含空格的目录,然后在 apps/web 中运行 vp build。报告的修复是将 URL 包装进 fileURLToPath,它来自 node:url。当从带空格的路径构建成功,并且从普通路径也仍然构建成功时,即完成。

由索引模型根据 Issue 内容生成。

描述

Before submitting
  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.
Area

Build, CI, or release tooling

Steps to reproduce
  1. Clone the repo into a directory whose path contains a space, e.g. ~/Local Sites/t3code.
  2. pnpm install --frozen-lockfile --filter=@t3tools/web...
  3. cd apps/web && vp build
Expected behavior

The web app builds, as it does from a path without spaces.

Actual behavior

The build fails while bundling the office file viewers' worker:

[plugin vite:worker-import-meta-url] …/apps/web/src/components/files/office/WordDocument.tsx
[UNLOADABLE_DEPENDENCY] Could not load ../../../../Local%20Sites/t3code/apps/web/src/components/files/office/fonts-cjk.ts
  ╭─[ ../../node_modules/.pnpm/@[email protected]/node_modules/@betteroffice/fonts/dist/index.js:574:26 ]
574 │     return (await import("@betteroffice/fonts-cjk")).CJK_FONT_ASSET_URLS;
    │                          ╰── No such file or directory (os error 2)

(The same error for Presentation.tsx.)

Cause: apps/web/vite.config.ts resolves the alias with new URL("./src/components/files/office/fonts-cjk.ts", import.meta.url).pathname. URL.pathname is percent-encoded, so a space becomes %20 and the aliased path does not exist. fileURLToPath decodes it:

import * as NodeURL from "node:url";
// …
"@betteroffice/fonts-cjk": NodeURL.fileURLToPath(
  new URL("./src/components/files/office/fonts-cjk.ts", import.meta.url),
),

With that change the build succeeds from the same path.

Impact

Minor bug or occasional failure

Version or commit

v0.1.5 and v0.1.6; still present on main at 84537c4dd9 (2026-11-02).

Environment

macOS 26.7.1 (arm64), Node 26.12.0, pnpm 12.14.0, vite-plus 1.4.0.

Workaround

Build from a path without spaces, or apply the fileURLToPath change above.

主要语言
TypeScript
星标
24.8k
派生
6.4k
平均合并
7 小时 39 分钟
30 天内合并 PR
123

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pingdotgg/t3code 的其他 Issue

查看 pingdotgg/t3code 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。