diff --git a/packages/frontend-builder/locale-inliner.ts b/packages/frontend-builder/locale-inliner.ts index 1dc344e2a3..8d0d6e3d20 100644 --- a/packages/frontend-builder/locale-inliner.ts +++ b/packages/frontend-builder/locale-inliner.ts @@ -80,7 +80,7 @@ export class LocaleInliner { await fs.mkdir(path.join(this.outputDir, localeName), { recursive: true }); const localeLogger = localeName === 'ja-JP' ? this.logger : blankLogger; // we want to log for single locale only for (const chunk of this.chunks) { - if (!chunk.sourceCode || !chunk.modifications) { + if (chunk.sourceCode == null || !chunk.modifications) { throw new Error(`Source code or modifications for ${chunk.fileName} is not available.`); } const fileLogger = localeLogger.prefixed(`${chunk.fileName} (${chunk.chunkName}): `); diff --git a/packages/frontend-builder/locale-inliner/collect-modifications.ts b/packages/frontend-builder/locale-inliner/collect-modifications.ts index 2e92a407c9..80ce268f95 100644 --- a/packages/frontend-builder/locale-inliner/collect-modifications.ts +++ b/packages/frontend-builder/locale-inliner/collect-modifications.ts @@ -18,6 +18,7 @@ interface WalkerContext { } export function collectModifications(sourceCode: string, fileName: string, fileLogger: Logger, inliner: LocaleInliner): TextModification[] { + if (sourceCode === '') return []; let programNode: RolldownESTree.Program; try { programNode = parseAst(sourceCode);