From 68be8343e7eb6fd671ec175b699a2212dfdf097e Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Mon, 12 Aug 2024 09:24:18 +0200 Subject: [PATCH] Builder-Vite: Add null character prefix to virtual file IDs in code generator plugin --- .../src/plugins/code-generator-plugin.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/builders/builder-vite/src/plugins/code-generator-plugin.ts b/code/builders/builder-vite/src/plugins/code-generator-plugin.ts index f841c47cf7e5..ac0fe2a3b970 100644 --- a/code/builders/builder-vite/src/plugins/code-generator-plugin.ts +++ b/code/builders/builder-vite/src/plugins/code-generator-plugin.ts @@ -70,33 +70,33 @@ export function codeGeneratorPlugin(options: Options): Plugin { }, resolveId(source) { if (source === virtualFileId) { - return virtualFileId; + return `\0${virtualFileId}`; } if (source === iframePath) { return iframeId; } if (source === virtualStoriesFile) { - return virtualStoriesFile; + return `\0${virtualStoriesFile}`; } if (source === virtualPreviewFile) { return virtualPreviewFile; } if (source === virtualAddonSetupFile) { - return virtualAddonSetupFile; + return `\0${virtualAddonSetupFile}`; } return undefined; }, async load(id, config) { - if (id === virtualStoriesFile) { + if (id === `\0${virtualStoriesFile}`) { return generateImportFnScriptCode(options); } - if (id === virtualAddonSetupFile) { + if (id === `\0${virtualAddonSetupFile}`) { return generateAddonSetupCode(); } - if (id === virtualFileId) { + if (id === `\0${virtualFileId}`) { return generateModernIframeScriptCode(options, projectRoot); }