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 00000000000000..9cc726ff2a53d6 --- /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 8ebe39c87ae43c..4b51379589f001 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,