Closed sgentry closed 4 years ago
Is this for tsdx build
specifically? There's an existing issue for Babel not being run on TS during tsdx test
(#583)
Otherwise, there are integration tests for Babel configs for tsdx build
. Reading the @emotion/babel-preset-css-prop
docs, it says it changes the JSX from React.createElement
to its own thing. So you'd probably need to set your tsconfig.json
's jsx
property to 'preserve'
or something instead of 'react'
.
When jsx: 'react'
is set, TypeScript compiles the JSX instead of Babel. That's a TS thing rather than TSDX specific, so you wouldn't really find that in TSDX docs.
Yes, this was for tsdx build
. Looks like you are correct in that changing jsx
to preserve
fixed my issue. Sorry for the hassle but I appreciate your response. Thanks!
Current Behavior
I've added an additional Babel preset (@emotion/babel-preset-css-prop) using .babelrc. When my React component has a .tsx file extension, this preset doesn't seem to get applied to transpiled output in dist folder. If I rename to .jsx, works great. Maybe I'm missing some additional configuration for this to work but I haven't found anything yet looking through docs.
Expected behavior
I expect my additional preset to be applied to all ts/tsx files.
Suggested solution(s)
Additional context
Your environment