diff --git a/code/addons/essentials/src/docs/preset.ts b/code/addons/essentials/src/docs/preset.ts index af022cfece92..805fc5e7b3c3 100644 --- a/code/addons/essentials/src/docs/preset.ts +++ b/code/addons/essentials/src/docs/preset.ts @@ -3,6 +3,8 @@ export * from '@storybook/addon-docs/dist/preset'; export const mdxLoaderOptions = async (config: any) => { // eslint-disable-next-line no-param-reassign - config.mdxCompileOptions.providerImportSource = '@storybook/addon-essentials/docs/mdx-react-shim'; + config.mdxCompileOptions.providerImportSource = require.resolve( + '@storybook/addon-docs/dist/shims/mdx-react-shim' + ); return config; }; diff --git a/code/builders/builder-vite/src/plugins/mdx-plugin.ts b/code/builders/builder-vite/src/plugins/mdx-plugin.ts index 4f50a0b38159..3bbbe2bf6019 100644 --- a/code/builders/builder-vite/src/plugins/mdx-plugin.ts +++ b/code/builders/builder-vite/src/plugins/mdx-plugin.ts @@ -33,7 +33,7 @@ export async function mdxPlugin(options: Options): Promise { const mdxLoaderOptions = await options.presets.apply('mdxLoaderOptions', { ...mdxPluginOptions, mdxCompileOptions: { - providerImportSource: '@storybook/addon-docs/mdx-react-shim', + providerImportSource: require.resolve('@storybook/addon-docs/mdx-react-shim'), ...mdxPluginOptions?.mdxCompileOptions, remarkPlugins: [remarkSlug, remarkExternalLinks].concat( mdxPluginOptions?.mdxCompileOptions?.remarkPlugins ?? []