Skip to content

Commit

Permalink
Add JSX extension to @rollup/plugin-node-resolve options (#524)
Browse files Browse the repository at this point in the history
* Add JSX extension to @rollup/plugin-node-resolve options

* Add test for JSX chaining import

* Correct comment link
  • Loading branch information
n3tr authored Mar 11, 2020
1 parent 3530265 commit 735f301
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/createRollupConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export async function createRollupConfig(
'main',
opts.target !== 'node' ? 'browser' : undefined,
].filter(Boolean) as string[],
// defaults + .jsx
extensions: ['.mjs', '.js', '.jsx', '.json', '.node'],
}),
opts.format === 'umd' &&
commonjs({
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/build-default/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import './syntax/nullish-coalescing';
import './syntax/optional-chaining';

import './syntax/jsx-import/JSX-import-JSX';

export { foo } from './foo';

export const sum = (a: number, b: number) => {
Expand Down
7 changes: 7 additions & 0 deletions test/fixtures/build-default/src/syntax/jsx-import/JSX-A.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// DO NOT IMPORT THIS FILE DIRECTLY FROM index.ts
// THIS FILE IS INTENTIONALLY TO TEST JSX CHAINING IMPORT
// SEE https://github.com/jaredpalmer/tsdx/issues/523

import JSXB from './JSX-B';

export default JSXB;
7 changes: 7 additions & 0 deletions test/fixtures/build-default/src/syntax/jsx-import/JSX-B.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// DO NOT IMPORT THIS FILE DIRECTLY FROM index.ts
// THIS FILE IS INTENTIONALLY TO TEST JSX CHAINING IMPORT
// SEE https://github.com/jaredpalmer/tsdx/issues/523

export default function JSXComponent() {
return 'JSXC';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Testing for jsx chaining import
// https://github.com/jaredpalmer/tsdx/issues/523

export * from './JSX-A';

0 comments on commit 735f301

Please sign in to comment.