gaoxiaoliangz/react-scoped-css

Requires babel?

Closed this issue · 2 comments

It seems like this solution is tightly-coupled with babel as it only works if you add a plugin to your .babelrc file. I'm using Typescript as a transpiler. Is there any way I can use this library?

It relies on babel and webpack under the hood. Can you provide a more detailed setup of the project you are working on, maybe an integration can be made.

c17r commented

My current project is using Laravel Mix (even though it's not using Laravel on the backend) and if you tell Mix you are using Typescript it will have ts-loader in the pipeline before babel-loader. In order for this extension to work in that scenario, you need to make sure tsconfig has "jsx": "preserve" otherwise ts-loader handles it and you end up with code that doesn't know about the "v-data".

If you want to run this process completely without babel, there would need to be a ts-loader transformer written similar to https://github.com/Igorbek/typescript-plugin-styled-components