Skip to content

fix(frontend): pre-bundle every base-ui entry point, not the bystander - #2399

Merged
dzarlax merged 1 commit into
constructorfabric:mainfrom
dzarlax:fix/storybook-preoptimize-base-ui
Aug 10, 2026
Merged

fix(frontend): pre-bundle every base-ui entry point, not the bystander#2399
dzarlax merged 1 commit into
constructorfabric:mainfrom
dzarlax:fix/storybook-preoptimize-base-ui

Conversation

@dzarlax

@dzarlax dzarlax commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

main currently carries a storybook test that fails on some runs and not others. #2398 was meant to stop it and did not — the dependency it added was a bystander.

What is actually happening

The failure reads:

TypeError: Failed to fetch dynamically imported module: …/sb-vitest/deps/exceljs.js?v=…

The line above it in the same run names the cause:

✨ new dependencies optimized: @base-ui/react/merge-props
✨ optimized dependencies changed. reloading

A dependency reached only after a story mounts is discovered mid-run. Vite re-optimizes and reloads the page, and the reload kills whichever import is in flight. That import is reported as the failure — so the slowest thing to load takes the blame for something it did not do. exceljs is simply the slowest thing in that suite.

The change

Nine of the eighteen @base-ui/react/* entry points the source imports were missing from optimizeDeps.include. Any one of them can be the late discovery, so all eighteen are listed rather than the one that surfaced this week.

The comment now carries the rule that would have saved a round: read the dependency named by "new dependencies optimized", never the test that failed — and a one-liner to check the set still matches the source.

exceljs stays. It is genuinely imported dynamically and belongs on the list; it was just not the cause.

Verification

Cold cache, both node_modules/.vite and the storybook cache removed, and verified by the absence of the mechanism rather than by a run that happened to pass: no "new dependencies optimized" line appears at all, where CI logged one for merge-props. 1041 tests pass across both projects, tsc -b clean.

That distinction matters here. #2398 was also "verified" by a passing queue run, and the same failure appeared two runs later — a green run proves nothing about a race, only the missing trigger does.

The xlsx export story keeps failing with "Failed to fetch dynamically imported
module … exceljs.js", and adding `exceljs` to the pre-bundled list did not stop
it. It was never the cause.

The line above it in the run output names the cause: "new dependencies
optimized: @base-ui/react/merge-props", then "optimized dependencies changed.
reloading". A late-discovered dependency makes vite reload the page, and the
reload kills whichever import is in flight. That is reported as a failure of the
import — so the slowest thing to load takes the blame for something it did not
do.

Nine of the eighteen `@base-ui/react/*` entry points the source imports were
missing from the list. Any of them can be the one discovered late, so all
eighteen are listed now rather than the one that happened to surface. The
comment carries the rule that would have saved a round: read the dependency
named by "new dependencies optimized", never the test that failed.

Verified on a cold cache — both `node_modules/.vite` and the storybook cache
removed — by the absence of the mechanism rather than by a passing run: no
"new dependencies optimized" line appears at all, where CI logged one for
merge-props. 1041 tests pass across both projects.

Signed-off-by: Alexey Panfilov <Alexey.Panfilov@constructor.tech>
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@dzarlax, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 16 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f91aed28-bb10-4cdc-850b-c877ada37cfa

📥 Commits

Reviewing files that changed from the base of the PR and between 79d948d and f99eb7f.

📒 Files selected for processing (1)
  • src/frontend/vitest.config.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@dzarlax
dzarlax added this pull request to the merge queue Aug 10, 2026
Merged via the queue into constructorfabric:main with commit feaca85 Aug 10, 2026
53 checks passed
@dzarlax
dzarlax deleted the fix/storybook-preoptimize-base-ui branch August 10, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants