From a2d9940169cf61f83a6389bbe302be94c173cf6c Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 24 Apr 2024 17:12:04 +0800 Subject: [PATCH] fix: properly handle the case when import.meta.env is undefined --- src/storybook.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/storybook.ts b/src/storybook.ts index 580eff5a..d5e72646 100644 --- a/src/storybook.ts +++ b/src/storybook.ts @@ -105,6 +105,8 @@ export async function setupStorybook(options: ModuleOptions, nuxt: Nuxt) { logger.info(' ') logger.info('✔ Storybook build done ') logger.info(' ') + // @ts-expect-error: officially import.meta.env is never undefined, but in practice it can be + import.meta.env = import.meta.env || {} import.meta.env.__STORYBOOK__ = JSON.stringify(options) })