From bb46d575a18c3c4545f08d44b034b7ef1e2c5274 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Wed, 14 Dec 2022 18:05:58 +0800 Subject: [PATCH] Csf-plugin: Fix spurious storiesOf warnings --- code/lib/csf-plugin/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/lib/csf-plugin/src/index.ts b/code/lib/csf-plugin/src/index.ts index 8204a1f723ac..d75d169b9c96 100644 --- a/code/lib/csf-plugin/src/index.ts +++ b/code/lib/csf-plugin/src/index.ts @@ -23,7 +23,11 @@ export const unplugin = createUnplugin((options) => { enrichCsf(csf, options); return formatCsf(csf); } catch (err: any) { - logger.warn(err.message); + // This can be called on legacy storiesOf files, so just ignore + // those errors. But warn about other errors. + if (!err.message?.startsWith('CSF:')) { + logger.warn(err.message); + } return code; } },