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);