Igorbek / typescript-plugin-styled-components

TypeScript transformer for improving the debugging experience of styled-components
418 stars 34 forks source link

CRA example #38

Open phmatray opened 5 years ago

phmatray commented 5 years ago

Would it be possible to add an example to the README showing how to configure typescript-plugin-styled-components with CRA2 --typescript?

Igorbek commented 5 years ago

Thank you for filing a request.

CRA2 uses Babel to transpile code and does not use any webpack typescript loaders. First of all, there's another solution for Babel: babel-plugin-styled-components. It might be sufficient for your goals. Second, after some research it seems to be impossible to configure Babel's typescript transformer to use custom TypeScript transformers which the current plugin is.

I'll appreciate any information or examples from people who used this plugin with babel/CRA. And I will continue digging into that, but it's not a priority until any useful insights come up.

atatakobry commented 3 years ago

FYI: CRA allows to start project with typescript support, so this plugin looks very interesting. Unfortunately, I have no idea how to make it works :(

tuzmusic commented 2 years ago

Thank you for filing a request.

CRA2 uses Babel to transpile code and does not use any webpack typescript loaders. First of all, there's another solution for Babel: babel-plugin-styled-components.

Are you saying that your the babel plugin will work for CRA with TS, and that your plugin is only necessary for custom TS installations?

Igorbek commented 2 years ago

That's right, this plug-in is not for Babel. It is for such setups where the TypeScript compiler is used.

tuzmusic commented 2 years ago

@atatakobry @phmatray I've just succeeded in getting the "original" babel plugin to work in my CRA typescript app by following the instructions here.