From 7758e8f5ff518ccc35d912b1719062156b5f1f7a Mon Sep 17 00:00:00 2001 From: Bryan Thomas <49354825+bryanjtc@users.noreply.github.com> Date: Mon, 18 Sep 2023 07:49:38 -0500 Subject: [PATCH] Keep the previous providerImportSource value --- code/addons/docs/src/plugins/mdx-plugin.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/addons/docs/src/plugins/mdx-plugin.ts b/code/addons/docs/src/plugins/mdx-plugin.ts index d49e86822eb2..82f754fd3cd8 100644 --- a/code/addons/docs/src/plugins/mdx-plugin.ts +++ b/code/addons/docs/src/plugins/mdx-plugin.ts @@ -3,6 +3,7 @@ import type { Plugin } from 'vite'; import remarkSlug from 'remark-slug'; import remarkExternalLinks from 'remark-external-links'; import { createFilter } from '@rollup/pluginutils'; +import { dirname, join } from 'path'; const isStorybookMdx = (id: string) => id.endsWith('stories.mdx') || id.endsWith('story.mdx'); @@ -33,7 +34,10 @@ export async function mdxPlugin(options: Options): Promise { const mdxLoaderOptions = await options.presets.apply('mdxLoaderOptions', { ...mdxPluginOptions, mdxCompileOptions: { - providerImportSource: require.resolve('@storybook/mdx2-csf'), + providerImportSource: join( + dirname(require.resolve('@storybook/addon-docs/package.json')), + '/dist/shims/mdx-react-shim' + ), ...mdxPluginOptions?.mdxCompileOptions, remarkPlugins: [remarkSlug, remarkExternalLinks].concat( mdxPluginOptions?.mdxCompileOptions?.remarkPlugins ?? []