From 01847b15c43e40ddc6f98c1dacb3d0509551bfb1 Mon Sep 17 00:00:00 2001 From: Katerina Skroumpelou Date: Mon, 16 Oct 2023 18:12:32 +0300 Subject: [PATCH] fix(react): storybook plugin tsconfig resolution (#19631) --- packages/react/plugins/storybook/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react/plugins/storybook/index.ts b/packages/react/plugins/storybook/index.ts index 8bd0bf6dc0643..afa2c65a8cf1b 100644 --- a/packages/react/plugins/storybook/index.ts +++ b/packages/react/plugins/storybook/index.ts @@ -169,7 +169,13 @@ export const webpack = async ( const { withNx, withWeb } = require('@nx/webpack'); const projectData = await getProjectData(options); - const tsconfigPath = join(projectData.projectRoot, 'tsconfig.storybook.json'); + const tsconfigPath = existsSync( + join(projectData.projectRoot, 'tsconfig.storybook.json') + ) + ? join(projectData.projectRoot, 'tsconfig.storybook.json') + : join(projectData.projectRoot, 'tsconfig.json'); + // The 'tsconfig.json' is mainly for the cypress test to be able to run + // because it will look into the cypress project dir and it will not find tsconfig.storybook.json fixBabelConfigurationIfNeeded(storybookWebpackConfig, projectData);