Repository navigation
fix(storybook): resolve monorepo module aliases to raw source and prevent docgen AST crashes - #6274
VisheshDDev wants to merge 2 commits into
Conversation
|
@tylerslaton @jpr5 @ranst91 @marthakelly @mme @BenTaylorDev @VisheshDDev Thanks!! |
|
Are there any updates? Thanks! |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
BenTaylorDev
left a comment
There was a problem hiding this comment.
Thanks for the PR, and sorry for the slow reply here.
This bundles two unrelated changes, and I have findings on both. I would like to see them split.
1. The getItemKey change duplicates a PR I already closed
getItemKey: (index) => deduplicatedMessages[index]!.id in CopilotChatMessageView.tsx is the same change as #6564, which I closed on 2026-08-21. The reasoning still applies: #6089 reports height-variance hopping, where long code blocks measure far above estimateSize: () => 100. getItemKey only re-keys the virtualizer's internal measurement cache, so it does not touch that mechanism. On an append-only chat, index keys and id keys agree.
The change is a genuine improvement on its own merits, because deduplicatedMessages can drop an entry mid-list and shift every later index. I am happy to take it as a standalone PR with a test, and without the Fixes #6089 link. If you do re-file it, please use deduplicatedMessages[index]?.id ?? index rather than the non-null assertion.
Leaving #6089 open.
2. The Storybook alias change removes every Tailwind utility
I built Storybook twice locally, once on main and once with this branch's .storybook/main.ts. Both builds succeed. The bundles differ:
main |
this PR | |
|---|---|---|
| build result | success | success |
compiled cpk: utility selectors |
1332 | 0 |
.cpk\:flex, .cpk\:flex-col, ... |
present | absent |
The cause is this alias:
"@copilotkit/react-core/v2/styles.css": path.join(reactCorePkgPath, "src/v2/styles/globals.css"),globals.css is a Tailwind v4 source file. Its first line is @import "tailwindcss" prefix(cpk);. The example has no postcss.config.* and no tailwindcss dependency, so nothing compiles it. Webpack inlines Tailwind's own index.css and emits zero utility classes. The build stays green and every story renders unstyled.
The alias also skips packages/react-core/scripts/scope-preflight.mjs, which scopes @layer base under [data-copilotkit] to stop CopilotKit styles leaking into the host page. That step runs as part of build:css and produces dist/v2/index.css, which is what the current alias-free setup already resolves through package exports.
Smaller notes on the same file
- The stated root cause does not match the repo. The description says path resolution was off by one hop, from
../../../../.git log --all -S'../../../../' -- examples/v2/react/storybook/.storybook/main.tsreturns exactly one commit,1d367c635, which is this branch's own first commit.main.tsonmainhas never contained path math. - The dist race is narrowed, not eliminated.
@copilotkit/shared,@copilotkit/web-inspector, and@copilotkit/web-componentsare imported from react-core v2 source and still resolve todist, and thedevscript still runstsdown --watch. console.log("React core package path:", reactCorePkgPath)prints on every startup. Please drop it.- The
module.rules.map(...)block maps each rule to{ ...rule }and returns everything else unchanged, so it is a no-op. Please drop it. symlinks: trueis already the webpack default.
What I am asking for
- Split the
CopilotChatMessageView.tsxchange into its own PR, with a test, and without the issue link. - Drop the
styles.cssalias, or add a real Tailwind build for the example. Verify by grepping the built bundle forcpk\:selectors. - Remove the
console.log, the no-opmodule.rulesblock, andsymlinks: true. - Update the description so the root cause matches what is on
main.
One note for anyone reading this while looking for a #6089 fix: this PR does not fix it, and the issue stays open.
|
Thanks for this, @VisheshDDev. Closing it, for the reasons in the 2026-09-02 review: the Storybook alias change removes every compiled The |
What does this PR do?
Resolves Storybook build failures and module resolution errors when running local development (
pnpm dev) inexamples/v2/react/storybook.Root Causes Identified:
.storybook/main.tswas off by one directory hop (../../../../instead of../../.../../), placing resolution paths insideexamples/instead of the monorepo root.tsdown --watchalongside Storybook deleted files indist/v2on startup, causingModule not founderrors as Webpack tried to read them simultaneously.react-docgenattempted to parse minified.mjsbuild artifacts inpackages/core/dist/, crashing the AST parser.Key Changes:
.storybook/main.tsto cleanly target thepackages/root.@copilotkit/react-core/v2$and@copilotkit/core$Webpack aliases to point directly to raw TypeScript source files (src/v2/index.tsandsrc/index.ts).src/v2/styles/globals.css.Benefits:
dist/file deletion race conditions during concurrent watch tasks.react-docgenfrom bundled JavaScript while maintaining full auto-generated prop tables from TypeScript interfaces.Related PRs and Issues
Checklist