Skip to content

Commit eafb4a0

Browse files
authored
fix: add extensions to the test option of React plugin (#24)
1 parent 6d7a1db commit eafb4a0

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@playwright/test": "^1.54.1",
4141
"@rsbuild/core": "^1.4.12",
4242
"@rsbuild/plugin-preact": "^1.5.1",
43-
"@rsbuild/plugin-react": "^1.3.4",
43+
"@rsbuild/plugin-react": "^1.4.0",
4444
"@rsbuild/plugin-svgr": "^1.2.1",
4545
"@rsbuild/plugin-vue": "^1.1.0",
4646
"@rslib/core": "^0.11.0",

pnpm-lock.yaml

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ export const pluginMdx = (options: PluginMdxOptions = {}): RsbuildPlugin => ({
6363
if (chain.plugins.has(REACT_FAST_REFRESH)) {
6464
chain.plugins.get(REACT_FAST_REFRESH).tap((options) => {
6565
const firstOption = options[0] ?? {};
66+
if (firstOption.test) {
67+
firstOption.test = [
68+
...(Array.isArray(firstOption.test)
69+
? firstOption.test
70+
: [firstOption.test]),
71+
MDX_REGEXP,
72+
];
73+
}
6674
firstOption.include = [...(firstOption.include || []), MDX_REGEXP];
6775
options[0] = firstOption;
6876
return options;

0 commit comments

Comments
 (0)