Revert "ReactDocgen: Try using the latest version of the original"#33499
Conversation
|
View your CI Pipeline Execution ↗ for commit fc87a01
☁️ Nx Cloud last updated this comment at |
📝 WalkthroughWalkthroughMigrated from the legacy Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
✨ Finishing touches
Comment |
There was a problem hiding this comment.
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: RemovegitHeadfrom source-controlled package.json.The value ends with a non-hex character ('l') and contains 41 characters instead of the required 40. More importantly,
gitHeadis 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—PluginOptionsis not exported from@storybook/react-docgen-typescript-plugin.The import at line 6 will fail type-checking because
@storybook/react-docgen-typescript-plugindoes not exportPluginOptions. Define the type locally or import from the unscopedreact-docgen-typescript-pluginif 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 exportsReactDocgenTypeScriptPluginas 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
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (7)
code/lib/cli-storybook/src/sandbox-templates.tscode/presets/create-react-app/package.jsoncode/presets/create-react-app/src/types.tscode/presets/react-webpack/package.jsoncode/presets/react-webpack/src/framework-preset-react-docs.test.tscode/presets/react-webpack/src/framework-preset-react-docs.tscode/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.tscode/presets/create-react-app/src/types.tscode/presets/react-webpack/src/framework-preset-react-docs.test.tscode/presets/react-webpack/package.jsoncode/presets/create-react-app/package.jsoncode/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 commandcross-env NODE_ENV=production eslint --cache --cache-location=../.cache/eslint --ext .js,.jsx,.json,.html,.ts,.tsx,.mjs --report-unused-disable-directivesto fix linting errors before committing
Files:
code/presets/react-webpack/src/types.tscode/presets/create-react-app/src/types.tscode/presets/react-webpack/src/framework-preset-react-docs.test.tscode/presets/react-webpack/package.jsoncode/presets/create-react-app/package.jsoncode/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.tscode/presets/create-react-app/src/types.tscode/presets/react-webpack/src/framework-preset-react-docs.test.tscode/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 useconsole.log,console.warn, orconsole.errordirectly unless in isolated files where importing loggers would significantly increase bundle size
Files:
code/presets/react-webpack/src/types.tscode/presets/create-react-app/src/types.tscode/presets/react-webpack/src/framework-preset-react-docs.test.tscode/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
loggerfromstorybook/internal/node-loggerfor server-side logging in Node.js code
Files:
code/presets/react-webpack/src/types.tscode/presets/create-react-app/src/types.tscode/presets/react-webpack/src/framework-preset-react-docs.test.tscode/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.mdcfor 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}: Usevi.mock()with thespy: trueoption for all package and file mocks in Vitest tests
Place all mocks at the top of the test file before any test cases
Usevi.mocked()to type and access the mocked functions in Vitest tests
Implement mock behaviors inbeforeEachblocks 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 withoutvi.mocked()in Vitest tests
Avoid mock implementations outside ofbeforeEachblocks in Vitest tests
Avoid mocking without thespy: trueoption 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 withvi.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
Usevi.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.tscode/presets/create-react-app/src/types.tscode/presets/react-webpack/src/framework-preset-react-docs.test.tscode/presets/react-webpack/package.jsoncode/presets/create-react-app/package.jsoncode/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.tscode/presets/react-webpack/package.jsoncode/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.jsoncode/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.jsoncode/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 version1.0.6--canary.9.0c3f3b7.0is 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
PluginOptionsfrom@storybook/react-docgen-typescript-pluginis 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.0exists 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.
| import type { TypescriptOptions } from '@storybook/core-webpack'; | ||
| import ReactDocgenTypescriptPlugin from '@storybook/react-docgen-typescript-plugin'; | ||
|
|
There was a problem hiding this comment.
🧩 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 -+1Repository: 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 -50Repository: 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 -20Repository: 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 -30Repository: 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 -5Repository: storybookjs/storybook
Length of output: 47
🏁 Script executed:
# Look for the package in code/lib or similar locations
fd "react-docgen-typescript-plugin" --type dRepository: 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 -20Repository: 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 -10Repository: 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 -20Repository: 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 -20Repository: 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 -20Repository: 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 jsRepository: 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 -50Repository: 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 tsRepository: 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.
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| 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 |
Reverts #33454
I have found a major regression when react components are exported directly like so:
When users change their code to be like so:
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
✏️ Tip: You can customize this high-level summary in your review settings.