Fork me on GitHub
#shadow-cljs
<
2023-04-08
>
cartesian-theatrics05:04:22

I'm getting an error with a npm module I'm trying to use

This code cannot be transpiled. import.meta. Use --chunk_output_type=ES_MODULES to allow passthrough support.
Is there a way to pass this option to google closure? I believe this issue is the offending code is never actually called in a browser environment, but closure throws on it anyway.

thheller06:04:52

unfortunately no, the closure compiler is very picky about such things. can't do anything about that except using a different bundler https://shadow-cljs.github.io/docs/UsersGuide.html#js-provider-external

cartesian-theatrics07:04:05

Okay thanks, looks like I'll have go that route. Is this the route you'd recommend if there's basically just one external library that I need?

knubie13:04:29

Is there something weird about the way this library is structured that makes it not importable by shadow-cljs? https://github.com/ReactTooltip/react-tooltip I get this error when building: The required JS dependency "react-tooltip" is not available, it was required by "demo.cljs". Here is a simple repro build: https://github.com/mochi-cards/shadow-cljs--react-tooltip

thheller14:04:21

yes, it only supports the module exports specified in package.json, and has no fallback to the "old ways". shadow-cljs does not support that yet

Sam Ritchie14:04:50

Would providing a path into the package source tree work?

knubie14:04:19

Old way would be "main": "foo.js" right?

knubie14:04:51

Adding "main": "dist/react-tooltip.cjs" to the package.json seems to work. thanks!