mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 08:44:12 +08:00
20 lines
380 B
Plaintext
20 lines
380 B
Plaintext
```ts
|
|
// mdx-plugin.ts
|
|
|
|
import mdx from 'vite-plugin-mdx';
|
|
|
|
import { createCompiler } from '@storybook/csf-tools/mdx';
|
|
|
|
export function mdxPlugin() {
|
|
return mdx((filename) => {
|
|
const compilers = [];
|
|
|
|
if (filename.endsWith('stories.mdx') || filename.endsWith('story.mdx')) {
|
|
compilers.push(createCompiler({}));
|
|
}
|
|
return {
|
|
compilers,
|
|
};
|
|
});
|
|
}
|
|
``` |