Microbundle: tsx files crash build on JSX lines in 0.12.0

Created on 9 May 2020  路  4Comments  路  Source: developit/microbundle

.tsx files seem to crash build on lines where JSX is used (version 0.12.0)

(rpt2 plugin) Error: C:/dev/react-easy-flip/src/AnimateInOut.tsx(140,8): semantic error TS2304: Cannot find name 'h'.
needs more info

All 4 comments

@jlkiri Do you have a little more information like the cli command with arguments you use to call microbundle and maybe a sample snippet of the code you're feeding into it?

Oh, I just noticed that h is default for JSX and not React.createElement (I use React).
It worked fine for me with microbundle -f es,cjs --jsx React.createElement.
On 0.11.0 I didn't have to specify --jsx flag 馃

However, perhaps unrelated to this issue, the bundle size increased from 2.23KB to 2.69KB.

Happy to hear that you found the root cause. I was curious, so I poked through the git history and this is the line were we transpiled jsx in 0.11.0:

https://github.com/developit/microbundle/blob/2c32109528c6b4d370afe44e20d0c09e2b18c3d9/src/index.js#L556

Maybe you were transpiling JSX before running microbundle, like via TypeScript directly?

However, perhaps unrelated to this issue, the bundle size increased from 2.23KB to 2.69KB.

That's strange. Looks like something we don't test for in our suite yet. Can you share more details?

I'll take a closer look at the bundle size later, but this issue I think can be closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrstntdd picture chrstntdd  路  4Comments

adriengibrat picture adriengibrat  路  4Comments

MarkLyck picture MarkLyck  路  4Comments

SleeplessByte picture SleeplessByte  路  3Comments

dmitrykurmanov picture dmitrykurmanov  路  3Comments