From 29e7d1751194ee545fb5e447be07ea22c772b060 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Thu, 14 Nov 2024 14:03:06 +0100 Subject: [PATCH] Merge pull request #29617 from storybookjs/yann/fix-dep-optimization-issue Addon Test: Only optimize react deps if applicable in vitest-plugin (cherry picked from commit b3a9dfddec21fa8dfdda382efc66da91c727930e) --- code/addons/test/src/vitest-plugin/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/addons/test/src/vitest-plugin/index.ts b/code/addons/test/src/vitest-plugin/index.ts index ebe4bb20b281..968b0e656141 100644 --- a/code/addons/test/src/vitest-plugin/index.ts +++ b/code/addons/test/src/vitest-plugin/index.ts @@ -134,13 +134,13 @@ export const storybookTest = (options?: UserOptions): Plugin => { config.optimizeDeps ??= {}; config.optimizeDeps = { ...config.optimizeDeps, - include: [ - ...(config.optimizeDeps.include ?? []), - 'react-dom/test-utils', - '@storybook/experimental-addon-test/**', - ], + include: [...(config.optimizeDeps.include ?? []), '@storybook/experimental-addon-test/**'], }; + if (frameworkName?.includes('react') || frameworkName?.includes('nextjs')) { + config.optimizeDeps.include.push('react-dom/test-utils'); + } + if (frameworkName?.includes('vue3')) { config.define ??= {}; config.define.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = 'false';