Microbundle: Support for the React 17 JSX Transform.

Created on 9 Dec 2020  路  7Comments  路  Source: developit/microbundle

I am running into an error which I suspect to be caused by the release of React 17.
@see https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html

Typescript 4.1 followed by supporting as well the new JSX Factory

However when I run microbundle-crl --no-compress --format modern, cjs I get the following errors.

rpt2: config error TS6046: Argument for '--jsx' option must be: 'preserve', 'react-native', 'react'.

(rpt2 plugin) Error:.../Select/index.ts(1,20): semantic error TS6142: Module './Select' was resolved to '.../Select/Select.tsx', but '--jsx' is not set.
Error: .../Select/index.ts(1,20): semantic error TS6142: Module './Select' was resolved to '.../Select.tsx', but '--jsx' is not set.

I have indeed jsx: "react-jsx" in my tsconfig.js

Is there a quick solution for this?
Thanks

Feature Request

Most helpful comment

I don't believe rollup-plugin-typescript2 has been updated for TS 4.1 yet. Likely will have to wait until they support it.

All 7 comments

+1, it would be very nice if I don't have to downgrade my react version again :)

I don't believe rollup-plugin-typescript2 has been updated for TS 4.1 yet. Likely will have to wait until they support it.

I'm not sure what needs to be updated if anything. I whitelisted "module": "ES2020" in master branch in case it is needed.

Could you set plugin verbosity to 3 and post the output (it will print out parsed tsconfig and versions of related apps)

Might just be #741. Sorry, didn't look too deeply into it, I assumed it was rpt2 but might've just been trying to use the older TS version even with the newer JSX options

@ezolenko Yep, sorry to bring up rpt2. It was #741. Bad guess on my part, apologies.

This should be fixed in #741 and also because we've updated to TypeScript 4. It will be released at some point.

Also just a note: React 17 supports createElement just fine. There's no need to quickly jump to using jsx-runtime.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omgovich picture omgovich  路  16Comments

scttcper picture scttcper  路  11Comments

zzswang picture zzswang  路  14Comments

aaronjensen picture aaronjensen  路  16Comments

Conaclos picture Conaclos  路  11Comments