t3code icon indicating copy to clipboard operation
t3code copied to clipboard

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

Open sipak opened this issue 4 weeks ago • 1 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] 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.

sipak avatar Nov 02 '26 21:11 sipak

Fixed by #29051, now on main: Building from a checkout path containing spaces no longer encounters the reported fonts-cjk %20 resolution failure because main removes that alias and its stub entirely and installs the actual font package.

juliusmarminge avatar Nov 11 '26 19:11 juliusmarminge