KonstantinSimeonov / tsx-control-statements

Control flow JSX/TSX elements that get compiled to plain old javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What about babel-plugin-macros for integrating with create-react-app?

chrispaterson opened this issue · comments

Thanks for writing this library! I feel like if I could get it to work it would improve the readability of the TSX so much more. I ran into an issue with 4.0.0 that I can't seem to solve:

./node_modules/tsx-control-statements/components.ts 7:28
Module parse failed: Unexpected token (7:28)
You may need an appropriate loader to handle this file type, currently no loaders 
are configured to process this file. See https://webpack.js.org/concepts#loaders
|  */  
|         
> export function Choose(props: { children?: any; }) {
|       return props.children;
| }    

Which I suspect is because I'm using create-react-app – I have not ejected – so webpack is not using the typescript loader but I'm not exactly sure. The next step would be for me to eject, but I'm not sure I'm willing to do that yet.

While digging, I see that create-react-app supports babel-plugin-macros could this work as a potential solution to tsx-control-statements working with create-react-app?

PS. I noticed the package.json for transformer indicates that types are located in index.ts but there is no such file in the deployed library.