From 7e4d45a947659ee5c685b4176ab5616b25fd4cc2 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Thu, 14 Nov 2024 13:18:42 +0100 Subject: [PATCH] Addon Test: Only optimize react deps if applicable in vitest-plugin --- 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';