pugjs / babel-plugin-transform-react-pug

A plugin for transpiling pug templates to jsx
MIT License
808 stars 46 forks source link

not support tsx? #140

Open wuguojun1006 opened 3 years ago

wuguojun1006 commented 3 years ago

image image

why?????

skotchpine commented 3 years ago

@wuguojun1006 the current workaround is to add a side effect that uses every import. Something as simple and ugly as:

import x; x

If I remember correctly, the problem is that tsc strips unused variables before the pug is transformed.

There are other issues here that have more explanation and discussion. You can search to find more infos.

Im about to start a library like this, but with the lit approach, so that tsc works the way we need. I’ll ping you when it’s up.

ezhlobo commented 3 years ago

@skotchpine I'm happy to see that you are working on a separate solution similar to this. I'd also be happy to participate in any discussions or contribute to the solution.

I also think of refactoring this library, however I don't have many ideas to make it work with tsc, so it would be great tto collaborate on that :).

StackTrac3 commented 3 years ago

the current workaround is to add a side effect that uses every import. Something as simple and ugly as:

import x; x

This should be in the documentation. Being ugly is no excuse for hiding a crucial workaround in the GitHub issues.

Check out react/jsx-uses-vars