Microbundle: Unknown compiler option 'jsxFragmentFactory'

Created on 28 Aug 2020  路  6Comments  路  Source: developit/microbundle

I guess MicroBundle hasn't support TypeScript 4.x, because I got an error:

rpt2: config error TS5023: Unknown compiler option 'jsxFragmentFactory'.

good first issue hacktoberfest help wanted

Most helpful comment

Not only tsconfig.json options but also code syntax will have the same ts version problem.

In my case:

try {
  something()
} catch (e: unknown) {
         ^ (rpt2 plugin) Error: semantic error TS1196: Catch clause variable cannot have a type annotation.
  something()
}

Where here (e: unknown) is new syntax in TS 4.0, it's recommanded (safer) and checked by ESLint.

Maybe microbundle can try locally installed ts first before using rpt2's default one. Or at least some way to set the version manually.

All 6 comments

Thanks will look into it 馃憤

Could you create a small comment on how to reproduce this? Or do you have a repo?

Just add an option "jsxFragmentFactory": "Fragment" in your tsconfig.json, and then run microbundle again, you'll see the error.

Here is the offical document: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#custom-jsx-factories

We should check TS version and use the appropriate config - it would be a shame to have Microbundle only work with TS 4.

Not only tsconfig.json options but also code syntax will have the same ts version problem.

In my case:

try {
  something()
} catch (e: unknown) {
         ^ (rpt2 plugin) Error: semantic error TS1196: Catch clause variable cannot have a type annotation.
  something()
}

Where here (e: unknown) is new syntax in TS 4.0, it's recommanded (safer) and checked by ESLint.

Maybe microbundle can try locally installed ts first before using rpt2's default one. Or at least some way to set the version manually.

Thanks for the idea and PR @whitetrefoil - good thinking.

Fixed in #738.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrstntdd picture chrstntdd  路  4Comments

dmitrykurmanov picture dmitrykurmanov  路  3Comments

breadadams picture breadadams  路  3Comments

cowboyd picture cowboyd  路  3Comments

jlkiri picture jlkiri  路  4Comments