From 39a1462ef926e5c6dfa19d424d3db74285c6830e Mon Sep 17 00:00:00 2001 From: Tajudeen Date: Sun, 31 May 2026 14:29:10 +0100 Subject: [PATCH] fix(build): transpile watcher stages codicon.ttf so dev-mode icons render MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit codicon.ttf ships in node_modules/@vscode/codicons and is normally moved into src/ by gulp's copy-codicons task before transpile runs. The watch-client-transpile entry point (build/next/index.ts) doesn't depend on gulp, so a dev who runs only `npm run watch-client-transpile` (instead of the full `npm run watch`) ends up with no font in src/, no font in out/, and every workbench glyph rendering as a tofu box. Add a small idempotent ensureCodiconFontStaged() called from copyAllNonTsFiles() — checks the destination, copies once if missing, no-op afterwards. The cost is one stat per build cycle. Co-Authored-By: Claude Opus 4.7 (1M context) --- build/next/index.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/build/next/index.ts b/build/next/index.ts index 1993dbf6d6f..75cfd01fcce 100644 --- a/build/next/index.ts +++ b/build/next/index.ts @@ -535,7 +535,28 @@ async function compileStandaloneFiles(outDir: string, doMinify: boolean, target: * Used for development/transpile builds only - production bundles use * copyResources() with curated per-target patterns instead. */ +// codicon.ttf is shipped via node_modules, not committed to src/. The gulp `copy-codicons` +// task normally stages it into src/ before transpile runs — but `watch-client-transpile` +// (this entry point) doesn't depend on gulp, so a dev who only runs the transpile watcher +// ends up with no icon font and the workbench renders every glyph as a tofu box. Ensure +// the file is in src/ here so the glob below picks it up. +function ensureCodiconFontStaged(): void { + const fontSrc = path.join(REPO_ROOT, 'node_modules', '@vscode', 'codicons', 'dist', 'codicon.ttf'); + const fontDest = path.join(REPO_ROOT, SRC_DIR, 'vs', 'base', 'browser', 'ui', 'codicons', 'codicon', 'codicon.ttf'); + if (fs.existsSync(fontDest)) { + return; + } + if (!fs.existsSync(fontSrc)) { + console.warn(`[codicons] codicon.ttf missing from node_modules — run "npm install" to fix icon rendering.`); + return; + } + fs.mkdirSync(path.dirname(fontDest), { recursive: true }); + fs.copyFileSync(fontSrc, fontDest); + console.log(`[codicons] Staged codicon.ttf into ${path.relative(REPO_ROOT, fontDest)}`); +} + async function copyAllNonTsFiles(outDir: string, excludeTests: boolean): Promise { + ensureCodiconFontStaged(); console.log(`[resources] Copying all non-TS files to ${outDir}...`); const ignorePatterns = [