Skip to content

Conversation

@valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Dec 3, 2025

Closes #

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 pull request has been released as version 0.0.0-pr-33269-sha-f9786a2f. Try it out in a new sandbox by running npx [email protected] sandbox or in an existing project with npx [email protected] upgrade.

More information
Published version 0.0.0-pr-33269-sha-f9786a2f
Triggered by @valentinpalkovic
Repository storybookjs/storybook
Branch valentin/rolldown-optimized
Commit f9786a2f
Datetime Wed Dec 3 13:59:10 UTC 2025 (1764770350)
Workflow run 19896391102

To request a new release of this pull request, mention the @storybookjs/core team.

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

Apply plugin hook filters to Vite plugins to optimize performance by reducing
Rust-to-JS communication overhead. Filters allow Rolldown/Vite to determine
whether hooks need to be invoked without leaving Rust.

Changes:
- Add filter to code-generator-plugin for virtual module IDs
- Add filter to external-globals-plugin for packages in code
- Add filter to inject-export-order-plugin for story files
- Add filter to strip-story-hmr-boundaries for story files
- Add filter to vite-inject-mocker load hook

All filters include fallback checks in handlers to maintain backward
compatibility with Vite versions < 6.3.0 that don't support filters.

Note: Previous work by another agent included:
- Fixed Vue3 renderer bug for URL args in isolation mode
- Fixed Prettier type leakage issue
- Removed mocking utilities registration
…ization

Implement support for Rolldown's native MagicString in Vite builder plugins
to enable significant performance improvements when available.

Changes:
- Update external-globals-plugin to detect and use native MagicString
- Update inject-export-order-plugin with native MagicString support
- Update strip-story-hmr-boundaries with native MagicString support
- Add fallback logic for backward compatibility with regular Vite
- Add comprehensive tests for native MagicString functionality
- Add documentation explaining the implementation and benefits

Performance benefits (based on Rolldown benchmarks):
- 1.15x to 1.33x faster build times
- 1.63x to 2.26x faster plugin transform times
- Greater improvements with larger codebases

The implementation maintains full backward compatibility:
- Works with regular Vite (uses JavaScript MagicString)
- Works with older Vite versions (< 6.3.0)
- Works with Rolldown (uses native MagicString when available)
- No configuration changes required for users
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Fails
🚫

PR is not labeled with one of: ["cleanup","BREAKING CHANGE","feature request","bug","documentation","maintenance","build","dependencies"]

🚫

PR is not labeled with one of: ["ci:normal","ci:merged","ci:daily","ci:docs"]

Generated by 🚫 dangerJS against f9786a2

@nx-cloud
Copy link

nx-cloud bot commented Dec 3, 2025

View your CI Pipeline Execution ↗ for commit f9786a2

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

☁️ Nx Cloud last updated this comment at 2025-12-03 14:16:54 UTC

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