From 2f8889168e5eb240982eed565dcd7e1b01f2db6c Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Thu, 21 Dec 2023 10:49:33 +0100 Subject: [PATCH] Merge pull request #25286 from storybookjs/norbert/skip-framework-check-react-native Core: Skip no-framework error when ignorePreview=true (cherry picked from commit 2ea84ae768a074f62c35eecf4c9516bc3e5e62c6) --- code/lib/core-server/src/build-dev.ts | 11 ++++++++--- code/lib/core-server/src/build-static.ts | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/code/lib/core-server/src/build-dev.ts b/code/lib/core-server/src/build-dev.ts index 96bbc120fc7f..0b59384745bc 100644 --- a/code/lib/core-server/src/build-dev.ts +++ b/code/lib/core-server/src/build-dev.ts @@ -74,10 +74,15 @@ export async function buildDevStandalone( const { framework } = config; const corePresets = []; - const frameworkName = typeof framework === 'string' ? framework : framework?.name; - validateFrameworkName(frameworkName); + let frameworkName = typeof framework === 'string' ? framework : framework?.name; + if (!options.ignorePreview) { + validateFrameworkName(frameworkName); + } + if (frameworkName) { + corePresets.push(join(frameworkName, 'preset')); + } - corePresets.push(join(frameworkName, 'preset')); + frameworkName = frameworkName || 'custom'; try { await warnOnIncompatibleAddons(config); diff --git a/code/lib/core-server/src/build-static.ts b/code/lib/core-server/src/build-static.ts index cde136c47413..b09300c56cc6 100644 --- a/code/lib/core-server/src/build-static.ts +++ b/code/lib/core-server/src/build-static.ts @@ -73,7 +73,7 @@ export async function buildStaticStandalone(options: BuildStaticStandaloneOption const frameworkName = typeof framework === 'string' ? framework : framework?.name; if (frameworkName) { corePresets.push(join(frameworkName, 'preset')); - } else { + } else if (!options.ignorePreview) { logger.warn(`you have not specified a framework in your ${options.configDir}/main.js`); }