Conversation
Storybook's Vite preview now uses @vitejs/plugin-react-swc + @swc/plugin-emotion instead of @vitejs/plugin-react + @emotion/babel-plugin, removing Babel from Storybook's build pipeline. Speeds up the dev-loop HMR turnaround (~3-5x faster per-edit in local measurement); cold build-storybook time is roughly a wash. @vitejs/plugin-react-swc, @swc/plugin-emotion, and the @swc/core resolution are pinned to versions from the same release window (June-July 2026) rather than latest - newer combinations crash with an undocumented WASM/ABI mismatch between the plugin and swc_core. Bump these three together. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Storybook's Vite preview build currently reaches for Babel just to run
@emotion/babel-plugin(readable class names + Emotion source maps) — Babelis otherwise gone from this repo since the tsdown migration. This swaps that
one caller for
@vitejs/plugin-react-swc+@swc/plugin-emotion, soStorybook's build no longer touches Babel at all.
measurement (median ~43ms vs ~231ms across 5 warm samples each, editing one
line in a story file and timing to Vite's
page reloadlog line). This isthe actual win — it compounds on every save during
yarn storybook.yarn build-storybooktime is roughly a wash (15.6–21.2s vs18.3–18.5s Vite build step across 2 runs each)
autoLabel/labelFormatparity confirmed — generated classes still comeout as
gamut-<hash>-<ComponentName>, matching the Babel plugin's outputshape.
test:storiesunchanged: 87/87 files, 493/493 tests passing.Version pin is load-bearing, not incidental.
@vitejs/plugin-react-swc,@swc/plugin-emotion, and@swc/core(forced viaresolutions) are pinnedto versions from the same release window (June–July 2026) rather than
latest. The latest of each (Sept 2026, days apart) crashes with an opaque
WASM panic on real
.stories.tsx/.mdxfiles — an undocumented ABImismatch between the plugin and
swc_corethatplugins.swc.rs's owncompatibility lookup doesn't yet have data for. Left a comment in
main.tsso a routine dependency bump doesn't silently reintroduce this. Full repro
and investigation notes are in my local spike doc if anyone wants the details.
Test
yarn build-storybooksucceeds, including all.mdxdoc pagesyarn test:stories— 87/87 files, 493/493 testsyarn start:storybook— dev server starts clean, no console errorsautoLabel: 'always'/labelFormat: '[local]'parityBarChart/elements.tsxexplicittarget: 'gmt-category-label'call site unaffected (it's astyled()runtime arg, not transform output).stories.tsx, which triggers full page reload rather than a granular HMR swap) if the number needs to hold up further