Skip to content

Revert "ReactDocgen: Try using the latest version of the original"#33499

Merged
ndelangen merged 1 commit into
nextfrom
revert-33454-norbert/investigate-react-docgen-typescript-plugin
Jan 9, 2026
Merged

Revert "ReactDocgen: Try using the latest version of the original"#33499
ndelangen merged 1 commit into
nextfrom
revert-33454-norbert/investigate-react-docgen-typescript-plugin

Conversation

@ndelangen
Copy link
Copy Markdown
Member

@ndelangen ndelangen commented Jan 9, 2026

Reverts #33454

I have found a major regression when react components are exported directly like so:

export default function Header(){};

When users change their code to be like so:

function header(){};
export default Header

Everything functions correctly.

For now, I'll revert the change, and I'll seek a way to improve the upstream package so that it supports this use-case.

Summary by CodeRabbit

  • Chores
    • Updated React Docgen TypeScript plugin integration across Create React App and React Webpack presets to use Storybook's maintained variant, improving long-term dependency management and consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jan 9, 2026

View your CI Pipeline Execution ↗ for commit fc87a01

Command Status Duration Result
nx run-many -t compile,check,knip,test,pretty-d... ✅ Succeeded 11m 4s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-09 16:26:27 UTC

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 9, 2026

📝 Walkthrough

Walkthrough

Migrated from the legacy react-docgen-typescript-plugin package to @storybook/react-docgen-typescript-plugin across create-react-app and react-webpack presets, updating dependencies, imports, and type references. Removed the react-docgen-typescript override from the CRA sandbox template configuration.

Changes

Cohort / File(s) Summary
Sandbox Template Configuration
code/lib/cli-storybook/src/sandbox-templates.ts
Removed react-docgen-typescript override (typescript.reactDocgen) from cra/default-js template mainConfig
Create React App Preset
code/presets/create-react-app/package.json, code/presets/create-react-app/src/types.ts
Replaced react-docgen-typescript-plugin (^1.0.8) with @storybook/react-docgen-typescript-plugin (1.0.6--canary.9.0c3f3b7.0); updated RDTSPluginOptions type import source
React Webpack Preset
code/presets/react-webpack/package.json, code/presets/react-webpack/src/framework-preset-react-docs.ts, code/presets/react-webpack/src/framework-preset-react-docs.test.ts, code/presets/react-webpack/src/types.ts
Replaced react-docgen-typescript-plugin (^1.0.8) with @storybook/react-docgen-typescript-plugin (1.0.6--canary.9.0c3f3b7.0); updated all import paths for plugin and type references

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
code/presets/create-react-app/package.json (1)

50-54: Remove gitHead from source-controlled package.json.

The value ends with a non-hex character ('l') and contains 41 characters instead of the required 40. More importantly, gitHead is auto-generated by npm during packaging/publishing to record the git commit SHA—it should not be manually committed to the repository. Remove it and let npm add it automatically during publish.

code/presets/react-webpack/src/types.ts (1)

6-38: Fix broken type import—PluginOptions is not exported from @storybook/react-docgen-typescript-plugin.

The import at line 6 will fail type-checking because @storybook/react-docgen-typescript-plugin does not export PluginOptions. Define the type locally or import from the unscoped react-docgen-typescript-plugin if available.

Also update the JSDoc comment at line 32 to reflect the correct package name being configured, or align terminology with the actual dependency being used.

code/presets/react-webpack/src/framework-preset-react-docs.ts (1)

43-70: Fix import mismatch: the package exports ReactDocgenTypeScriptPlugin as default, not as a named export.

The code attempts named destructuring on line 43, but the test file—which correctly imports this package—uses a default import. This will cause a runtime error: "Cannot destructure property 'ReactDocgenTypeScriptPlugin' of undefined". Handle both export shapes with fallback logic to avoid failures:

Proposed fix
-  const { ReactDocgenTypeScriptPlugin } = await import('@storybook/react-docgen-typescript-plugin');
+  const rdtsMod = await import('@storybook/react-docgen-typescript-plugin');
+  const ReactDocgenTypeScriptPlugin =
+    (rdtsMod as any).ReactDocgenTypeScriptPlugin ??
+    (rdtsMod as any).default;
+
+  if (!ReactDocgenTypeScriptPlugin) {
+    throw new Error(
+      'Failed to load @storybook/react-docgen-typescript-plugin: missing ReactDocgenTypeScriptPlugin export.'
+    );
+  }
🤖 Fix all issues with AI agents
In @code/presets/react-webpack/src/framework-preset-react-docs.test.ts:
- Around line 3-5: The test imports the plugin as a default
(ReactDocgenTypescriptPlugin) but runtime uses the named export
ReactDocgenTypeScriptPlugin; update the test import to use the named import form
(import { ReactDocgenTypeScriptPlugin } ...) so the test mirrors production
import/export semantics and catches ESM/CJS mismatches for the
ReactDocgenTypeScriptPlugin symbol.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 535ca86 and fc87a01.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (7)
  • code/lib/cli-storybook/src/sandbox-templates.ts
  • code/presets/create-react-app/package.json
  • code/presets/create-react-app/src/types.ts
  • code/presets/react-webpack/package.json
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
  • code/presets/react-webpack/src/types.ts
💤 Files with no reviewable changes (1)
  • code/lib/cli-storybook/src/sandbox-templates.ts
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{js,jsx,ts,tsx,json,md,html,css,scss}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Format code using Prettier with yarn prettier --write <file>

Files:

  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/package.json
  • code/presets/create-react-app/package.json
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
**/*.{js,jsx,json,html,ts,tsx,mjs}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Run ESLint checks using yarn lint:js:cmd <file> or the full command cross-env NODE_ENV=production eslint --cache --cache-location=../.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directives to fix linting errors before committing

Files:

  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/package.json
  • code/presets/create-react-app/package.json
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Enable TypeScript strict mode across all packages

Files:

  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx}: Export functions from modules if they need to be tested
Do not use console.log, console.warn, or console.error directly unless in isolated files where importing loggers would significantly increase bundle size

Files:

  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
code/{core,lib,addons,builders,frameworks,presets}/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use logger from storybook/internal/node-logger for server-side logging in Node.js code

Files:

  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{test,spec}.{ts,tsx}: Test files should follow the naming pattern *.test.ts, *.test.tsx, *.spec.ts, or *.spec.tsx
Follow the spy mocking rules defined in .cursor/rules/spy-mocking.mdc for consistent mocking patterns with Vitest

Files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
**/*.test.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/spy-mocking.mdc)

**/*.test.{ts,tsx,js,jsx}: Use vi.mock() with the spy: true option for all package and file mocks in Vitest tests
Place all mocks at the top of the test file before any test cases
Use vi.mocked() to type and access the mocked functions in Vitest tests
Implement mock behaviors in beforeEach blocks in Vitest tests
Mock all required dependencies that the test subject uses
Each mock implementation should return a Promise for async functions in Vitest
Mock implementations should match the expected return type of the original function
Mock all required properties and methods that the test subject uses in Vitest tests
Avoid direct function mocking without vi.mocked() in Vitest tests
Avoid mock implementations outside of beforeEach blocks in Vitest tests
Avoid mocking without the spy: true option in Vitest tests
Avoid inline mock implementations within test cases in Vitest tests
Avoid mocking only a subset of required dependencies in Vitest tests
Mock at the highest level of abstraction needed in Vitest tests
Keep mock implementations simple and focused in Vitest tests
Use type-safe mocking with vi.mocked() in Vitest tests
Document complex mock behaviors in Vitest tests
Group related mocks together in Vitest tests

Files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{test,spec}.{ts,tsx,js,jsx}: Write meaningful unit tests that actually import and call the functions being tested, not just verify syntax patterns
Achieve high test coverage of business logic, aiming for 75%+ coverage of statements/lines
Cover all branches, conditions, edge cases, error paths, and different input variations in unit tests
Use vi.mock() to mock file system, loggers, and other external dependencies in tests

Files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
🧠 Learnings (18)
📓 Common learnings
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Applies to docs/**/migration*.md : Update migration guides for breaking changes
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/tooltip/WithTooltip.tsx:54-96
Timestamp: 2025-11-05T09:37:25.920Z
Learning: Repo: storybookjs/storybook — In code/core/src/components/components/tooltip/WithTooltip.tsx, the legacy WithTooltip implementation is intentionally reintroduced for backward compatibility and is deprecated; maintainers (per Sidnioulz) do not want maintenance or improvements on it. Prefer WithTooltipNew/Popover; avoid suggesting changes to WithTooltip.* going forward.
📚 Learning: 2025-11-05T09:38:47.712Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/Select/Select.tsx:200-204
Timestamp: 2025-11-05T09:38:47.712Z
Learning: Repo: storybookjs/storybook — Guidance: Until Storybook 11 is released, do not suggest using React.useId anywhere (e.g., in code/core/src/components/components/Select/Select.tsx) to maintain compatibility with React 17 runtimes. Prefer advising: accept a caller-provided props.id and, if needed, generate a client-only fallback id to minimize SSR hydration issues — but avoid useId. Resume prompting for useId after Storybook 11.

Applied to files:

  • code/presets/react-webpack/src/types.ts
  • code/presets/create-react-app/src/types.ts
  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
  • code/presets/react-webpack/package.json
  • code/presets/create-react-app/package.json
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
📚 Learning: 2025-10-01T15:24:01.060Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32594
File: code/core/src/components/components/Popover/WithPopover.tsx:7-9
Timestamp: 2025-10-01T15:24:01.060Z
Learning: In the Storybook repository, "react-aria-components/patched-dist/*" (e.g., "react-aria-components/patched-dist/Dialog", "react-aria-components/patched-dist/Popover", "react-aria-components/patched-dist/Tooltip") are valid import paths created by a patch applied to the react-aria-components package. These imports should not be flagged as broken or invalid until a maintainer explicitly states they are no longer acceptable.

Applied to files:

  • code/presets/create-react-app/src/types.ts
  • code/presets/react-webpack/package.json
  • code/presets/react-webpack/src/framework-preset-react-docs.ts
📚 Learning: 2025-12-22T22:03:40.123Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-22T22:03:40.123Z
Learning: Applies to **/*.{test,spec}.{ts,tsx,js,jsx} : Write meaningful unit tests that actually import and call the functions being tested, not just verify syntax patterns

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Document complex mock behaviors in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid mocking only a subset of required dependencies in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Mock all required properties and methods that the test subject uses in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid inline mock implementations within test cases in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Implement mock behaviors in `beforeEach` blocks in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Group related mocks together in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid mock implementations outside of `beforeEach` blocks in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `vi.mocked()` to type and access the mocked functions in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Avoid mocking without the `spy: true` option in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-11-24T17:49:59.279Z
Learnt from: CR
Repo: storybookjs/storybook PR: 0
File: .cursor/rules/spy-mocking.mdc:0-0
Timestamp: 2025-11-24T17:49:59.279Z
Learning: Applies to **/*.test.{ts,tsx,js,jsx} : Use `vi.mock()` with the `spy: true` option for all package and file mocks in Vitest tests

Applied to files:

  • code/presets/react-webpack/src/framework-preset-react-docs.test.ts
📚 Learning: 2025-09-29T13:20:23.346Z
Learnt from: mrginglymus
Repo: storybookjs/storybook PR: 32556
File: code/core/package.json:309-313
Timestamp: 2025-09-29T13:20:23.346Z
Learning: The `fast-printf` dependency in Storybook's core package is bundled into the final distribution during the build process, so it should remain in devDependencies rather than being moved to dependencies, following the same pattern as other bundled dependencies like `open`.

Applied to files:

  • code/presets/react-webpack/package.json
  • code/presets/create-react-app/package.json
📚 Learning: 2025-09-17T07:31:04.432Z
Learnt from: ndelangen
Repo: storybookjs/storybook PR: 32484
File: code/core/package.json:326-326
Timestamp: 2025-09-17T07:31:04.432Z
Learning: In Storybook's core package, dependencies like `open` are bundled into the final distribution during the build process, so they should remain in devDependencies rather than being moved to dependencies. End users don't need these packages as separate runtime dependencies since they're included in the bundled code.

Applied to files:

  • code/presets/react-webpack/package.json
  • code/presets/create-react-app/package.json
📚 Learning: 2025-11-05T09:37:25.920Z
Learnt from: Sidnioulz
Repo: storybookjs/storybook PR: 32458
File: code/core/src/components/components/tooltip/WithTooltip.tsx:54-96
Timestamp: 2025-11-05T09:37:25.920Z
Learning: Repo: storybookjs/storybook — In code/core/src/components/components/tooltip/WithTooltip.tsx, the legacy WithTooltip implementation is intentionally reintroduced for backward compatibility and is deprecated; maintainers (per Sidnioulz) do not want maintenance or improvements on it. Prefer WithTooltipNew/Popover; avoid suggesting changes to WithTooltip.* going forward.

Applied to files:

  • code/presets/react-webpack/package.json
📚 Learning: 2025-10-02T09:22:13.215Z
Learnt from: JReinhold
Repo: storybookjs/storybook PR: 32607
File: code/package.json:243-243
Timestamp: 2025-10-02T09:22:13.215Z
Learning: The Storybook repository uses Yarn v^4 (any 4.x version) as the package manager, configured via .yarnrc.yml and package.json packageManager field. Specific patch versions within v4 can be upgraded as needed.

Applied to files:

  • code/presets/create-react-app/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: normal
  • GitHub Check: nx
  • GitHub Check: nx
  • GitHub Check: nx
  • GitHub Check: nx
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (3)
code/presets/create-react-app/package.json (1)

35-41: The canary version 1.0.6--canary.9.0c3f3b7.0 is published on npm and can be installed.

However, there's an import inconsistency in the codebase: the production code (code/presets/react-webpack/src/framework-preset-react-docs.ts) uses a named import { ReactDocgenTypeScriptPlugin }, while the test file uses a default import. Verify that both import patterns (or the correct one) are supported by this version, especially for ESM module resolution in the preset context.

code/presets/create-react-app/src/types.ts (1)

3-20: Type import is correctly established across presets.

The import of PluginOptions from @storybook/react-docgen-typescript-plugin is consistent across both the create-react-app and react-webpack presets, with stable historical usage. No type incompatibilities are evident within the codebase.

code/presets/react-webpack/package.json (1)

42-42: Package version is valid and intentionally uses the double-dash canary format.

The version 1.0.6--canary.9.0c3f3b7.0 exists in the npm registry and was published on April 11, 2023. The double-dash format (e.g., 1.0.6--canary.9...) is an intentional pattern used by Storybook for canary releases—not a typo. The single-dash variant does not exist in the registry. The change correctly reverts to the Storybook-scoped plugin to address the default export regression.

Comment on lines 3 to 5
import type { TypescriptOptions } from '@storybook/core-webpack';
import ReactDocgenTypescriptPlugin from '@storybook/react-docgen-typescript-plugin';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the test file content around lines 3-5 and 91-103
cat -n code/presets/react-webpack/src/framework-preset-react-docs.test.ts | head -110 | tail -+1

Repository: storybookjs/storybook

Length of output: 186


🏁 Script executed:

# Now let's check the runtime implementation file to see how it imports
cat -n code/presets/react-webpack/src/framework-preset-react-docs.ts | head -50

Repository: storybookjs/storybook

Length of output: 1773


🏁 Script executed:

# Find and check the @storybook/react-docgen-typescript-plugin module to understand its exports
find . -type f -path "*/react-docgen-typescript-plugin/*" -name "package.json" -o -name "index.ts" -o -name "index.js" | head -20

Repository: storybookjs/storybook

Length of output: 909


🏁 Script executed:

# Search for where ReactDocgenTypeScriptPlugin (or similar) is exported
rg "export.*ReactDocgen" --type ts --type tsx --type js | head -30

Repository: storybookjs/storybook

Length of output: 92


🏁 Script executed:

# Read the test file specifically
cat -n code/presets/react-webpack/src/framework-preset-react-docs.test.ts | sed -n '1,15p'

Repository: storybookjs/storybook

Length of output: 710


🏁 Script executed:

# Read more of the test file, especially around line 102
cat -n code/presets/react-webpack/src/framework-preset-react-docs.test.ts | sed -n '90,105p'

Repository: storybookjs/storybook

Length of output: 668


🏁 Script executed:

# Find the actual react-docgen-typescript-plugin package
find . -type d -name "react-docgen-typescript-plugin" | head -5

Repository: storybookjs/storybook

Length of output: 47


🏁 Script executed:

# Look for the package in code/lib or similar locations
fd "react-docgen-typescript-plugin" --type d

Repository: storybookjs/storybook

Length of output: 47


🏁 Script executed:

# Look for react-docgen-typescript-plugin in packages or check if it's external
rg "react-docgen-typescript-plugin" --type json | head -20

Repository: storybookjs/storybook

Length of output: 303


🏁 Script executed:

# Check the package's actual index file to see what it exports
find . -path "*/node_modules/*" -prune -o -type f -name "index.ts" -print | xargs rg -l "ReactDocgen" | head -10

Repository: storybookjs/storybook

Length of output: 47


🏁 Script executed:

# Search for where ReactDocgenTypeScriptPlugin is defined (with the correct casing)
rg "ReactDocgenTypeScriptPlugin" --type ts --type js | head -20

Repository: storybookjs/storybook

Length of output: 329


🏁 Script executed:

# Also search for any variations of the export
rg "export.*class.*ReactDocgen" --type ts --type js | head -20

Repository: storybookjs/storybook

Length of output: 412


🏁 Script executed:

# Check if there's a .d.ts file that defines the exports
find . -name "*.d.ts" -type f | xargs rg "ReactDocgen" | head -20

Repository: storybookjs/storybook

Length of output: 47


🏁 Script executed:

# Let's check if there are type definitions or documentation about this package
# First, verify if the test could even work by checking what it expects
cat -n code/presets/react-webpack/src/framework-preset-react-docs.test.ts | sed -n '1,110p'

Repository: storybookjs/storybook

Length of output: 4052


🏁 Script executed:

# Look at the imports and usages more carefully, including the exact line 102
cat -n code/presets/react-webpack/src/framework-preset-react-docs.test.ts | sed -n '95,105p'

Repository: storybookjs/storybook

Length of output: 550


🏁 Script executed:

# Check if there's any other reference to ReactDocgenTypeScriptPlugin vs ReactDocgenTypescriptPlugin in the codebase
rg "ReactDocgenTypescript" --type ts --type js

Repository: storybookjs/storybook

Length of output: 861


🏁 Script executed:

# Let's verify what the external package actually exports by checking its type definitions
# The package version is specified in package.json, let's see if we can find more info
rg "@storybook/react-docgen-typescript-plugin" code/presets/react-webpack/ -A 5 -B 5 | head -50

Repository: storybookjs/storybook

Length of output: 3494


🏁 Script executed:

# Check if there's a mismatch in naming - let's look at both usages carefully
echo "=== Test import (line 4) ===" && cat -n code/presets/react-webpack/src/framework-preset-react-docs.test.ts | sed -n '4p'
echo "=== Runtime import (line 43) ===" && cat -n code/presets/react-webpack/src/framework-preset-react-docs.ts | sed -n '43p'

Repository: storybookjs/storybook

Length of output: 326


🏁 Script executed:

# Let's check what the actual test expects at line 102 with the name
cat -n code/presets/react-webpack/src/framework-preset-react-docs.test.ts | sed -n '102p'

Repository: storybookjs/storybook

Length of output: 131


🏁 Script executed:

# Let's also check the actual config output to see what gets passed to plugins
cat -n code/presets/react-webpack/src/framework-preset-react-docs.ts | sed -n '43,75p'

Repository: storybookjs/storybook

Length of output: 1162


🏁 Script executed:

# Verify if there are any other test files or imports that use this module differently
rg "react-docgen-typescript-plugin" code/presets/react-webpack/ --type ts

Repository: storybookjs/storybook

Length of output: 620


Fix import style mismatch: test uses default import while runtime uses named import.

The test imports ReactDocgenTypescriptPlugin as a default import, but the runtime code at line 43 uses the named import { ReactDocgenTypeScriptPlugin }. This inconsistency can hide real-world ESM/CJS export issues and the test should match the actual production import pattern.

Proposed change
 import type { TypescriptOptions } from '@storybook/core-webpack';
-import ReactDocgenTypescriptPlugin from '@storybook/react-docgen-typescript-plugin';
+import { ReactDocgenTypeScriptPlugin } from '@storybook/react-docgen-typescript-plugin';
@@
-        plugins: [expect.any(ReactDocgenTypescriptPlugin)],
+        plugins: [expect.any(ReactDocgenTypeScriptPlugin)],

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In @code/presets/react-webpack/src/framework-preset-react-docs.test.ts around
lines 3 - 5, The test imports the plugin as a default
(ReactDocgenTypescriptPlugin) but runtime uses the named export
ReactDocgenTypeScriptPlugin; update the test import to use the named import form
(import { ReactDocgenTypeScriptPlugin } ...) so the test mirrors production
import/export semantics and catches ESM/CJS mismatches for the
ReactDocgenTypeScriptPlugin symbol.

@storybook-app-bot
Copy link
Copy Markdown

Package Benchmarks

Commit: fc87a01, ran on 9 January 2026 at 16:24:38 UTC

The following packages have significant changes to their size or dependencies:

@storybook/nextjs

Before After Difference
Dependency count 534 538 🚨 +4 🚨
Self size 646 KB 646 KB 0 B
Dependency size 59.16 MB 59.19 MB 🚨 +28 KB 🚨
Bundle Size Analyzer Link Link

@storybook/react-webpack5

Before After Difference
Dependency count 274 278 🚨 +4 🚨
Self size 24 KB 24 KB 0 B
Dependency size 44.09 MB 44.12 MB 🚨 +28 KB 🚨
Bundle Size Analyzer Link Link

@storybook/preset-create-react-app

Before After Difference
Dependency count 64 68 🚨 +4 🚨
Self size 32 KB 32 KB 🚨 +36 B 🚨
Dependency size 5.95 MB 5.98 MB 🚨 +28 KB 🚨
Bundle Size Analyzer Link Link

@storybook/preset-react-webpack

Before After Difference
Dependency count 166 170 🚨 +4 🚨
Self size 18 KB 18 KB 🚨 +52 B 🚨
Dependency size 31.23 MB 31.26 MB 🚨 +28 KB 🚨
Bundle Size Analyzer Link Link

@ndelangen ndelangen merged commit 6399479 into next Jan 9, 2026
71 of 77 checks passed
@ndelangen ndelangen deleted the revert-33454-norbert/investigate-react-docgen-typescript-plugin branch January 9, 2026 16:30
@github-actions github-actions Bot mentioned this pull request Jan 9, 2026
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant