Skip to content

Commit 0c0b7ed

Browse files
authored
fix: warn when mdx plugin is after the plugin (#100)
1 parent fe46e56 commit 0c0b7ed

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/index.ts

+14
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,20 @@ const react = (_options?: Options): PluginOption[] => {
7575
include: [`${options.jsxImportSource}/jsx-dev-runtime`],
7676
},
7777
}),
78+
configResolved(config) {
79+
const mdxIndex = config.plugins.findIndex(
80+
(p) => p.name === "@mdx-js/rollup",
81+
);
82+
if (
83+
mdxIndex !== -1 &&
84+
mdxIndex >
85+
config.plugins.findIndex((p) => p.name === "vite:react-swc")
86+
) {
87+
config.logger.warn(
88+
"[vite:react-swc] The MDX plugin should be placed before this plugin",
89+
);
90+
}
91+
},
7892
transformIndexHtml: (_, config) => [
7993
{
8094
tag: "script",

0 commit comments

Comments
 (0)