Skip to content

fix(storybook): remove custom-babel-loader workaround#36385

Draft
PaulGMardling wants to merge 2 commits into
microsoft:masterfrom
PaulGMardling:fix/remove-custom-babel-loader
Draft

fix(storybook): remove custom-babel-loader workaround#36385
PaulGMardling wants to merge 2 commits into
microsoft:masterfrom
PaulGMardling:fix/remove-custom-babel-loader

Conversation

@PaulGMardling

Copy link
Copy Markdown

Previous Behavior

swc-loader passes sourcemaps to subsequent Webpack loaders as raw JSON strings (the native output format of SWC). When the react-storybook-addon-export-to-sandbox post-loader ran babel-loader on story files, babel-loader forwarded that string directly to Babel core, which only accepts boolean | object | undefined for inputSourceMap — causing the build

Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: .inputSourceMap must be a boolean, object, or undefined

A custom wrapper custom-babel-loader.ts was introduced to intercept the call and parse the string before passing it to babel-loader.

New Behavior

parseMap: true.
This tells swc-loader to parse its output sourcemap to an object before passing it downstream, so all subsequent loaders receive an object instead of a string. babel-loader can then be used directly in the addon's webpack rule — no custom wrapper needed.
custom-babel-loader.ts is deleted.

Related Issue(s)

#32290

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

📊 Bundle size report

✅ No changes found

@github-actions

Copy link
Copy Markdown

Pull request demo site: URL

@@ -0,0 +1,127 @@
---

@github-actions github-actions Bot Jul 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual changes to review in the Visual Change Report

vr-tests-react-components/Menu Converged - submenuIndicator slotted content 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default.submenus open.chromium.png 413 Changed
vr-tests-react-components/Positioning 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png 52 Changed
vr-tests-react-components/Positioning.Positioning end.chromium.png 761 Changed
vr-tests-react-components/ProgressBar converged 3 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png 67 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - Dark Mode.default.chromium.png 58 Changed
vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png 127 Changed
vr-tests-react-components/TagPicker 2 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests-react-components/TagPicker.disabled - Dark Mode.disabled input hover.chromium.png 658 Changed
vr-tests-react-components/TagPicker.disabled - High Contrast.disabled input hover.chromium.png 1319 Changed
vr-tests/Callout 8 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/Callout.Bottom right edge.default.chromium.png 1130 Changed
vr-tests/Callout.Beak 25.default.chromium.png 2198 Changed
vr-tests/Callout.Right top edge.default.chromium.png 1126 Changed
vr-tests/Callout.Root.default.chromium.png 2195 Changed
vr-tests/Callout.Left bottom edge.default.chromium.png 3182 Changed
vr-tests/Callout.Top center.default.chromium.png 2127 Changed
vr-tests/Callout.Top left edge.default.chromium.png 2212 Changed
vr-tests/Callout.Top right edge.default.chromium.png 1146 Changed
vr-tests/Keytip 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/Keytip.Root.default.chromium.png 55 Changed
vr-tests/react-charting-LineChart 4 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-LineChart.Events - RTL.default.chromium.png 15 Changed
vr-tests/react-charting-LineChart.Multiple.default.chromium.png 192 Changed
vr-tests/react-charting-LineChart.Events.default.chromium.png 17 Changed
vr-tests/react-charting-LineChart.Events - Dark Mode.default.chromium.png 16 Changed
vr-tests/react-charting-MultiStackBarChart 1 screenshots
Image Name Diff(in Pixels) Image Type
vr-tests/react-charting-MultiStackBarChart.Basic_Absolute.default.chromium.png 359 Changed

There were 4 duplicate changes discarded. Check the build logs for more information.

@PaulGMardling PaulGMardling force-pushed the fix/remove-custom-babel-loader branch from d45ca4a to 86d7d33 Compare July 10, 2026 14:46
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.

[Storybook]: Get rid of custom-babel-loader

1 participant