Skip to content

Commit 735f301

Browse files
authored
Add JSX extension to @rollup/plugin-node-resolve options (#524)
* Add JSX extension to @rollup/plugin-node-resolve options * Add test for JSX chaining import * Correct comment link
1 parent 3530265 commit 735f301

5 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/createRollupConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ export async function createRollupConfig(
114114
'main',
115115
opts.target !== 'node' ? 'browser' : undefined,
116116
].filter(Boolean) as string[],
117+
// defaults + .jsx
118+
extensions: ['.mjs', '.js', '.jsx', '.json', '.node'],
117119
}),
118120
opts.format === 'umd' &&
119121
commonjs({

test/fixtures/build-default/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import './syntax/nullish-coalescing';
22
import './syntax/optional-chaining';
33

4+
import './syntax/jsx-import/JSX-import-JSX';
5+
46
export { foo } from './foo';
57

68
export const sum = (a: number, b: number) => {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// DO NOT IMPORT THIS FILE DIRECTLY FROM index.ts
2+
// THIS FILE IS INTENTIONALLY TO TEST JSX CHAINING IMPORT
3+
// SEE https://github.com/jaredpalmer/tsdx/issues/523
4+
5+
import JSXB from './JSX-B';
6+
7+
export default JSXB;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// DO NOT IMPORT THIS FILE DIRECTLY FROM index.ts
2+
// THIS FILE IS INTENTIONALLY TO TEST JSX CHAINING IMPORT
3+
// SEE https://github.com/jaredpalmer/tsdx/issues/523
4+
5+
export default function JSXComponent() {
6+
return 'JSXC';
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Testing for jsx chaining import
2+
// https://github.com/jaredpalmer/tsdx/issues/523
3+
4+
export * from './JSX-A';

0 commit comments

Comments
 (0)