From 7ae568ab1eb3009076d2d8f45ff9121651ebe5bd Mon Sep 17 00:00:00 2001 From: Johannes Date: Wed, 11 Feb 2026 14:48:47 +0100 Subject: [PATCH] refactor: streamline NLS messages writing in finalizeNLS function --- build/next/nls-plugin.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/build/next/nls-plugin.ts b/build/next/nls-plugin.ts index caae95cb434..56cb84fa33a 100644 --- a/build/next/nls-plugin.ts +++ b/build/next/nls-plugin.ts @@ -134,19 +134,12 @@ export async function finalizeNLS( path.join(dir, 'nls.metadata.json'), JSON.stringify(nlsMetadataJson, null, '\t') ), + fs.promises.writeFile( + path.join(dir, 'nls.messages.js'), + `/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nglobalThis._VSCODE_NLS_MESSAGES=${JSON.stringify(allMessages)};` + ), ])); - // Write nls.messages.js only to additional dirs (e.g., out-build) for CI NLS upload, - // not to the primary bundle output dir where it would be an extra file vs the old build - if (alsoWriteTo) { - await Promise.all(alsoWriteTo.map(dir => - fs.promises.writeFile( - path.join(dir, 'nls.messages.js'), - `/*---------------------------------------------------------\n * Copyright (C) Microsoft Corporation. All rights reserved.\n *--------------------------------------------------------*/\nglobalThis._VSCODE_NLS_MESSAGES=${JSON.stringify(allMessages)};` - ) - )); - } - console.log(`[nls] Extracted ${allMessages.length} messages from ${moduleToKeys.size} modules`); return { indexMap, messageCount: allMessages.length };