Skip to content

Commit

Permalink
Keep the previous providerImportSource value
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjtc committed Sep 18, 2023
1 parent fc7fc7f commit 7758e8f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion code/addons/docs/src/plugins/mdx-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -33,7 +34,10 @@ export async function mdxPlugin(options: Options): Promise<Plugin> {
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 ?? []
Expand Down

0 comments on commit 7758e8f

Please sign in to comment.