Fork me on GitHub
#shadow-cljs
<
2019-01-03
>
Daniel Schlaug08:01:09

Hi everyone! I'm trying to use shadow-cljs to import an npm package that makes heavy use of jsx. It's my understanding that shadow-cljs does not directly support jsx and I understand that I could pre-compile any code in the local package but how I would go about pre-compiling the jsx in the external node module so that shadow-cljs would pick it up?

thheller11:01:13

@daniel975 it is very uncommon that jsx is actually published to npm? typically the package is converted first. are you sure the package contains actual jsx?

thheller11:01:50

otherwise you'd need to run babel on the package to convert but I would not recommend doing so. webpack only packages likely have other issues.

Daniel Schlaug20:01:25

@thheller I suspected that to be the case. The package is actually an internal module that we just pull down raw from git so it's a somewhat unusual package. I had an idea that I might make my cljs module have an index.js file that exports shadow cljs artifacts generated with compile npm. Not sure how that would impact my ability to add dependencies to the resulting hybrid module from other cljs modules though... I guess the other alternative would be to start converting our internal packages...

thheller20:01:02

typically all you need to do is run babel and let it convert the jsx files

thheller20:01:21

problem is that babel sometimes doesn't like running in node_modules. so I'd recommend converting and only publish "standard" JS to npm

Daniel Schlaug20:01:22

Indeed, the latter sounds like simpler solution.