From 73f6ba968afffd6a84459a08cf78a8e8fd85bb5d Mon Sep 17 00:00:00 2001 From: mattcompiles Date: Thu, 20 Jul 2023 20:30:00 +1000 Subject: [PATCH] Ignore virtual files --- packages/integration/src/inlineCompiler.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/integration/src/inlineCompiler.ts b/packages/integration/src/inlineCompiler.ts index f3558515b..4888411fc 100644 --- a/packages/integration/src/inlineCompiler.ts +++ b/packages/integration/src/inlineCompiler.ts @@ -356,9 +356,16 @@ export class InlineCompiler { filePath = isAbsolute(filePath) ? filePath : join(this.root, filePath); - // TODO: Improve perf. Reading all files from disk is wasteful. - // We can likely cache using the module graph - const code = await readFile(filePath, { encoding: 'utf-8' }); + let code; + + try { + // TODO: Improve perf. Reading all files from disk is wasteful. + // We can likely cache using the module graph + code = await readFile(filePath, { encoding: 'utf-8' }); + } catch (e) { + // Ignore virtual files + return null; + } const { shouldProcess, isLegacyCssFile } = await this.analyseModule( code, filePath,