From 76fba2cb5812da7d1a4f8014b4f092b48f013a9c Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Wed, 10 Aug 2022 02:03:36 -0500 Subject: [PATCH 1/2] fix: Conditionally sets jsxFactory & jsxImportSource in tsconfigs --- src/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 709ba2a2..e0758f3b 100644 --- a/src/index.js +++ b/src/index.js @@ -71,6 +71,7 @@ export default async function microbundle(inputOptions) { options.pkg.name = pkgName; if (options.sourcemap === 'inline') { + // eslint-disable-next-line no-console console.log( 'Warning: inline sourcemaps should only be used for debugging purposes.', ); @@ -549,9 +550,16 @@ function createConfig(options, entry, format, writeMeta) { ...(options.generateTypes !== false && { declarationDir: getDeclarationDir({ options, pkg }), }), - jsx: 'preserve', - jsxFactory: options.jsx, - jsxFragmentFactory: options.jsxFragment, + ...(options.jsxImportSource + ? { + jsx: 'react-jsx', + jsxImportSource: options.jsxImportSource, + } + : { + jsx: 'preserve', + jsxFactory: options.jsx, + jsxFragmentFactory: options.jsxFragment, + }), }, files: options.entries, }, @@ -642,6 +650,7 @@ function createConfig(options, entry, format, writeMeta) { options.visualize && visualizer(), // NOTE: OMT only works with amd and esm // Source: https://github.com/surma/rollup-plugin-off-main-thread#config + // eslint-disable-next-line new-cap useWorkerLoader && (format === 'es' || modern) && OMT(), /** @type {import('rollup').Plugin} */ ({ From e4d8db3420eb4e147d84a333fc4bb0b1c2688ba4 Mon Sep 17 00:00:00 2001 From: Ryan Christian Date: Wed, 10 Aug 2022 02:36:02 -0500 Subject: [PATCH 2/2] docs: Adding changeset --- .changeset/thick-radios-jump.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/thick-radios-jump.md diff --git a/.changeset/thick-radios-jump.md b/.changeset/thick-radios-jump.md new file mode 100644 index 00000000..84acdfe1 --- /dev/null +++ b/.changeset/thick-radios-jump.md @@ -0,0 +1,5 @@ +--- +'microbundle': patch +--- + +Fixes tsconfig merge issue with jsxImportSource and default jsxFactory value