From d30cadf1ce051ad75e9eb46e737599573df7a242 Mon Sep 17 00:00:00 2001 From: sooniter Date: Wed, 28 Oct 2026 17:58:48 +0800 Subject: [PATCH] fix(storybook): use a single React instance for Rspress stories --- .storybook/main.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.storybook/main.ts b/.storybook/main.ts index 5fc8115..36c95ca 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -14,6 +14,11 @@ const config: StorybookConfig = { config.resolve ??= {}; config.resolve.alias = { ...config.resolve.alias, + // Rspress has its own React dependency; hooks must use the renderer's instance. + react: fileURLToPath(new URL('../node_modules/react', import.meta.url)), + 'react-dom': fileURLToPath( + new URL('../node_modules/react-dom', import.meta.url), + ), // Rspress normally generates this module from the site's social links. 'virtual-social-links': fileURLToPath( new URL('./social-links.ts', import.meta.url),