From c97afc934f4b58c93d25e1ace2b070dfe7c46e68 Mon Sep 17 00:00:00 2001 From: Simen Brekken Date: Mon, 1 Nov 2021 14:40:29 +0100 Subject: [PATCH] Ensure preview or config file is loaded last --- packages/storybook-builder-vite/codegen-iframe-script.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/storybook-builder-vite/codegen-iframe-script.js b/packages/storybook-builder-vite/codegen-iframe-script.js index a6e0b304..2ab888b7 100644 --- a/packages/storybook-builder-vite/codegen-iframe-script.js +++ b/packages/storybook-builder-vite/codegen-iframe-script.js @@ -22,9 +22,12 @@ module.exports.generateIframeScriptCode = // is loaded. That way our client-apis can assume the existence of the API+store const frameworkImportPath = frameworkPath || `@storybook/${framework}`; - const configEntries = [loadPreviewOrConfigFile({ configDir })] - .concat(await presets.apply('config', [], options)) - .filter(Boolean); + const previewOrConfigFile = loadPreviewOrConfigFile({ configDir }); + const presetEntries = await presets.apply('config', [], options); + const configEntries = [previewOrConfigFile, ...presetEntries].filter( + Boolean + ); + const storyEntries = ( await Promise.all( (