fixes missing font file in monaco-editor (#322735)

This commit is contained in:
Henning Dieterichs
2026-06-24 17:47:01 +02:00
committed by GitHub
parent 830ba74cc2
commit b99aeda16a

View File

@@ -139,9 +139,9 @@ function transportCSS(module: string, enqueue: (module: string) => void, write:
function _rewriteOrInlineUrls(contents: string, forceBase64: boolean): string {
return _replaceURL(contents, (url) => {
const fontMatch = url.match(/^(.*).ttf\?(.*)$/);
const fontMatch = url.match(/^(.*)\.ttf(\?.*)?$/);
if (fontMatch) {
const relativeFontPath = `${fontMatch[1]}.ttf`; // trim the query parameter
const relativeFontPath = `${fontMatch[1]}.ttf`; // trim the optional query parameter
const fontPath = path.join(path.dirname(module), relativeFontPath);
enqueue(fontPath);
return relativeFontPath;