From c3f78f25aec35df39bf06d8bfa76cd845eca6440 Mon Sep 17 00:00:00 2001 From: Ray Knight Date: Mon, 31 Aug 2026 13:18:46 -0700 Subject: [PATCH] fix(react-storybook-addon-export-to-sandbox): find the addon registration on Windows The addonFilePattern accepted forward slashes only, but on Windows the registered preset name is an absolute path with backslashes, so the pattern matched nothing: the addon options were silently dropped and the full-source babel plugin crashed downstream on undefined importMappings. Accept either separator, with a comment recording why. Extracted from windmod branch commit 510b8c5d21 (webpack.ts hunk only). Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Aj9uA3rCVgosnh2zNn8qkc --- ...rt-to-sandbox-4a111ae2-83ac-4fad-8039-eeed61b69743.json | 7 +++++++ .../react-storybook-addon-export-to-sandbox/src/webpack.ts | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 change/@fluentui-react-storybook-addon-export-to-sandbox-4a111ae2-83ac-4fad-8039-eeed61b69743.json diff --git a/change/@fluentui-react-storybook-addon-export-to-sandbox-4a111ae2-83ac-4fad-8039-eeed61b69743.json b/change/@fluentui-react-storybook-addon-export-to-sandbox-4a111ae2-83ac-4fad-8039-eeed61b69743.json new file mode 100644 index 0000000000000..9cc726ff2a53d --- /dev/null +++ b/change/@fluentui-react-storybook-addon-export-to-sandbox-4a111ae2-83ac-4fad-8039-eeed61b69743.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix: match backslash-separated preset paths so the addon finds its registration on Windows", + "packageName": "@fluentui/react-storybook-addon-export-to-sandbox", + "email": "array.knight@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-storybook-addon-export-to-sandbox/src/webpack.ts b/packages/react-components/react-storybook-addon-export-to-sandbox/src/webpack.ts index 8ebe39c87ae43..4b51379589f00 100644 --- a/packages/react-components/react-storybook-addon-export-to-sandbox/src/webpack.ts +++ b/packages/react-components/react-storybook-addon-export-to-sandbox/src/webpack.ts @@ -16,7 +16,11 @@ export function webpack(config: WebpackFinalConfig, options: WebpackFinalOptions } const identity = (value: T) => value; -const addonFilePattern = /react-storybook-addon-export-to-sandbox\/[a-z/]+.[jt]s$/; +// Both path separators on purpose: on Windows the registered preset name is an absolute +// path with backslashes (e.g. `...\react-storybook-addon-export-to-sandbox\temp\preset.ts`); +// a forward-slash-only pattern fails to find the registration, silently drops the addon +// options, and the full-source babel plugin then crashes on undefined `importMappings`. +const addonFilePattern = /react-storybook-addon-export-to-sandbox[\\/][a-z\\/]+.[jt]s$/; const defaultOptions = { webpackRule: {}, babelLoaderOptionsUpdater: identity,