diff --git a/src/createRollupConfig.ts b/src/createRollupConfig.ts index 0092baf28..40a529099 100644 --- a/src/createRollupConfig.ts +++ b/src/createRollupConfig.ts @@ -108,6 +108,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({ diff --git a/test/fixtures/build-default/src/index.ts b/test/fixtures/build-default/src/index.ts index 1716e60ed..1a2adf25d 100644 --- a/test/fixtures/build-default/src/index.ts +++ b/test/fixtures/build-default/src/index.ts @@ -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) => { diff --git a/test/fixtures/build-default/src/syntax/jsx-import/JSX-A.jsx b/test/fixtures/build-default/src/syntax/jsx-import/JSX-A.jsx new file mode 100644 index 000000000..27f439c05 --- /dev/null +++ b/test/fixtures/build-default/src/syntax/jsx-import/JSX-A.jsx @@ -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; diff --git a/test/fixtures/build-default/src/syntax/jsx-import/JSX-B.jsx b/test/fixtures/build-default/src/syntax/jsx-import/JSX-B.jsx new file mode 100644 index 000000000..5d51e4235 --- /dev/null +++ b/test/fixtures/build-default/src/syntax/jsx-import/JSX-B.jsx @@ -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'; +} diff --git a/test/fixtures/build-default/src/syntax/jsx-import/JSX-import-JSX.jsx b/test/fixtures/build-default/src/syntax/jsx-import/JSX-import-JSX.jsx new file mode 100644 index 000000000..18d99216c --- /dev/null +++ b/test/fixtures/build-default/src/syntax/jsx-import/JSX-import-JSX.jsx @@ -0,0 +1,4 @@ +// Testing for jsx chaining import +// https://github.com/jaredpalmer/tsdx/issues/523 + +export * from './JSX-A';