Skip to content

Vite: Optimize @storybook/addon-docs/blocks dependency#32798

Merged
ndelangen merged 5 commits into
storybookjs:nextfrom
mrginglymus:optimize-startup
Oct 26, 2025
Merged

Vite: Optimize @storybook/addon-docs/blocks dependency#32798
ndelangen merged 5 commits into
storybookjs:nextfrom
mrginglymus:optimize-startup

Conversation

@mrginglymus
Copy link
Copy Markdown
Contributor

@mrginglymus mrginglymus commented Oct 22, 2025

What I did

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • Chores
    • Updated Vite dependency optimization configuration to include additional Storybook addon documentation dependencies.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 22, 2025

📝 Walkthrough

Walkthrough

The optimizeViteDeps constant in the Storybook docs addon preset configuration is expanded to include an additional dependency, @storybook/addon-docs/blocks, in the Vite optimization list alongside existing entries.

Changes

Cohort / File(s) Summary
Vite Dependency Optimization
code/addons/docs/src/preset.ts
Expanded optimizeViteDeps array to include @storybook/addon-docs/blocks entry for Vite optimization

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa8a708 and f746660.

📒 Files selected for processing (1)
  • code/addons/docs/src/preset.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,jsx,json,html,ts,tsx,mjs}

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

**/*.{js,jsx,json,html,ts,tsx,mjs}: Run Prettier formatting on changed files before committing
Run ESLint on changed files and fix all errors/warnings before committing (use yarn lint:js:cmd <file>)

Files:

  • code/addons/docs/src/preset.ts
**/*.{ts,tsx,js,jsx,mjs}

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

Export functions from modules when they need to be unit-tested

Files:

  • code/addons/docs/src/preset.ts
code/**/*.{ts,tsx,js,jsx,mjs}

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

In application code, use Storybook loggers instead of console.* (client code: storybook/internal/client-logger; server code: storybook/internal/node-logger)

Files:

  • code/addons/docs/src/preset.ts
{code/**,scripts/**}/**/*.{ts,tsx,js,jsx,mjs}

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

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/addons/docs/src/preset.ts
🔇 Additional comments (1)
code/addons/docs/src/preset.ts (1)

207-212: LGTM! Verify the package export exists.

The addition of '@storybook/addon-docs/blocks' to the Vite optimization list looks correct and follows the existing pattern. The multi-line formatting also improves readability.

Please ensure that @storybook/addon-docs/blocks is a valid export path from the @storybook/addon-docs package to confirm this resolves the startup optimization issue mentioned in #32775.

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Oct 22, 2025

View your CI Pipeline Execution ↗ for commit 7949b77

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 43s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-26 11:03:26 UTC

@mrginglymus mrginglymus changed the title Add @storybook/addon-docs/blocks explicitly to optimizeDeps Add @storybook/addon-docs/blocks to optimizeDeps Oct 22, 2025
@mrginglymus mrginglymus marked this pull request as ready for review October 23, 2025 07:13
@yannbf yannbf changed the title Add @storybook/addon-docs/blocks to optimizeDeps Vite: Optimize @storybook/addon-docs/blocks dependency Oct 24, 2025
@ndelangen ndelangen self-assigned this Oct 26, 2025
@ndelangen ndelangen added the maintenance User-facing maintenance tasks label Oct 26, 2025
@storybook-app-bot
Copy link
Copy Markdown

Package Benchmarks

Commit: 7949b77, ran on 26 October 2025 at 10:59:06 UTC

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

storybook

Before After Difference
Dependency count 43 43 0
Self size 23.62 MB 22.97 MB 🎉 -648 KB 🎉
Dependency size 17.36 MB 17.36 MB 0 B
Bundle Size Analyzer Link Link

@storybook/cli

Before After Difference
Dependency count 187 187 0
Self size 928 KB 928 KB 🎉 -84 B 🎉
Dependency size 73.57 MB 72.92 MB 🎉 -648 KB 🎉
Bundle Size Analyzer Link Link

@storybook/codemod

Before After Difference
Dependency count 169 169 0
Self size 35 KB 35 KB 0 B
Dependency size 70.00 MB 69.35 MB 🎉 -648 KB 🎉
Bundle Size Analyzer Link Link

create-storybook

Before After Difference
Dependency count 44 44 0
Self size 1.55 MB 1.55 MB 0 B
Dependency size 40.98 MB 40.33 MB 🎉 -648 KB 🎉
Bundle Size Analyzer node node

@ndelangen ndelangen merged commit 597c4fd into storybookjs:next Oct 26, 2025
54 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 26, 2025
11 tasks
@mrginglymus mrginglymus deleted the optimize-startup branch October 26, 2025 22:14
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.

[Bug]: Investigate performance implications of addon docs imports in preview

3 participants