Skip to content

Commit

Permalink
fix: Conditionally sets jsxFactory & jsxImportSource in tsconfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Aug 10, 2022
1 parent fd4ea1a commit 76fba2c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
);
Expand Down Expand Up @@ -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,
},
Expand Down Expand Up @@ -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} */
({
Expand Down

0 comments on commit 76fba2c

Please sign in to comment.