Fork me on GitHub
#shadow-cljs
<
2022-03-05
>
lilactown18:03:05

how would I customize the way that :browser-repl resolves an npm dep?

lilactown18:03:58

related, I don't know if this is something that shadow-cljs can fix but when trying to use https://github.com/solidjs/solid in a browser context it loads the server bundle. I think it's due to some "clever" routing they're doing in their package.json

lilactown18:03:50

e.g. when I require

(ns town.lilac.solid.web
  (:require
   ["solid-js/web/dist/web.cjs" :as web]
   ["solid-js/h" :as h]))
this will pull in both web/dist/web.cjs from the explicit require, and web/dist/server.cjs as a transitive dependency of solid-js/h

lilactown18:03:20

which ends up breaking stuff

thheller18:03:27

hmm it should be picking that on its own

thheller18:03:31

which shadow-cljs version do you use?

lilactown18:03:57

I can create an repo in a bit

thheller19:03:28

yeah I think I know what happens

thheller19:03:25

for now you can just override via resolve

thheller19:03:42

hmm no actually not

thheller19:03:51

same problem.

thheller19:03:22

it is picking the solid-js/package.json instead of the solid-js/web/package.json I believe

thheller19:03:55

can't check right now. too tired

lilactown19:03:57

no worries, I'm just messing around. thanks for looking into it for a bit

lilactown20:03:06

:js-options {:resolve
                        {"solid-js/web"
                         {:target :npm
                          :require "solid-js/web/dist/web.cjs"}}}
☝️:skin-tone-2: using that in my :app build config fixed it. might help for anyone else who runs across this and for figuring it out later