Skip to content

Commit 29d0b3e

Browse files
authored
feat: allow to import TSX files with .jsx extension (#3900)
1 parent 00917ab commit 29d0b3e

File tree

13 files changed

+74
-0
lines changed

13 files changed

+74
-0
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { build } from '@e2e/helper';
2+
import { expect, test } from '@playwright/test';
3+
4+
test('should allow to import TSX files with .jsx extension', async ({
5+
page,
6+
}) => {
7+
await build({
8+
cwd: __dirname,
9+
page,
10+
});
11+
expect(await page.evaluate(() => window.test)).toBe(1);
12+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const bar = () => {
2+
return <div>bar</div>;
3+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const foo = 1;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { bar } from './bar.jsx';
2+
import { foo } from './foo.jsx';
3+
4+
declare global {
5+
interface Window {
6+
test: number;
7+
}
8+
}
9+
10+
window.test = foo;
11+
12+
console.log(bar);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "@rsbuild/config/tsconfig",
3+
"compilerOptions": {
4+
"jsx": "react-jsx",
5+
"baseUrl": "./",
6+
"outDir": "./dist",
7+
"paths": {
8+
"@/*": ["./src/*"]
9+
}
10+
},
11+
"include": ["src", "*.test.ts"]
12+
}

0 commit comments

Comments
 (0)