shadow-cljs

dominicm 2025-10-21T20:42:44.830849Z

I'm having an issue with a module which only wants to be import and not require() - and I'm using :js-provider :external because I have a dependency with a dynamic import() that gcc doesn't want to know about. My "obvious" answer would be to have :external have a flag to spit out import() in place of require() or even for shadow to detect that dynamically via the presence of only importhttps://github.com/konstaui/konsta/blob/02d6956439c8867331542f386b35ee43a2aaf4fa/package/package.json#L29. But I honestly don't understand how this tower of JavaScript is delicately balanced and works in any way shape or form. Witchcraft.

thheller 2025-10-22T11:00:51.374769Z

you can set :external-index-format :esm so the external index uses import https://shadow-cljs.github.io/docs/UsersGuide.html#_js_tree_shaking

thheller 2025-10-22T11:01:45.201639Z

but if its using dynamic top-level imports it might cause issues due to its async nature. might need to go with :target :esm and :js-provider :import instead https://shadow-cljs.github.io/docs/UsersGuide.html#_third_party_tool_integration

thheller 2025-10-22T11:01:56.659359Z

:external is easier, so test that first

dominicm 2025-10-23T01:26:06.123449Z

external with the esm format has worked an absolute treat, thank you!