using a npm package with "main": "dist/index.umd.js"
throws some error like Cannot read property 'createGenerator' of undefined
, but it works if I use the esm instead. is that expected? can't find any mention of the difference in the user guide
also I think that error only happened in dev, not release
this package also has a "module": "dist/index.esm.js" in package.json which shadow-cljs seemed to ignore, preferring the umd
@kevin842 it is intentional that it defaults to using main
. compatibility is much better since not all packages provide module
and mixing has been a nightmare in the past. it can work but it largely depends on the packages you use. can't say much about the createGenerator
error without more information. you can make it use module
via setting :js-options {:entry-keys ["module" "browser" "main"]}
in the build config, the reverse is the default.
ah, nice. didn't see :entry-keys mentioned anywhere. I don't know what createGenerator is doing, but I guess you've seen different behavior with umd/esm? JS packaging seems like a real nightmare
yes, js packaging is weird and getting weirder every day almost
If i’m using :shadow {:main-opts ["-m" "shadow.cljs.devtools.cli"]}
in my deps.edn
to watch a build, should I get a REPL after navigating to my app? I remember getting this but haven’t seen it in awhile, and have been having issues connecting my editor and figured this was a good place to start.
this never gave you a REPL no
OK, I was following the Fireplace instructions via the Guide and when I try doing :CljEval (shadow/repl :my-app)
it says shadow
isn’t defined
well the actual namespace is (shadow.cljs.devtools.api/repl :my-app)
so wherever you are evaling likely just doesn't have that ns aliased
it is aliased by default if you are in shadow.user
but maybe you are just in user
Unfortunately using the full namespace actually creates a REPL prompt as the output, but doesn’t connect my editor 😅
sounds like you are maybe connecting to the wrong nrepl server?
or you need to load the shadow-cljs nrepl middleware in the one you are connected to
i’m using :nrepl {:port 51468}
in my shadow-cljs.edn, so it should be the right one, since I explicitly connect to that port.
What’s the nrepl middleware? cider/cider-nrepl
?
if you are connecting to the actual shadow-cljs nrepl server you don't need to worry about it. that will definitely have the middleware configured.
Any other suggestions for debugging this? Asking another colleague seems like what we used to use for connecting via emacs isn’t working either
I can't help with any cider/emacs related bits
The error they’re getting is :missing-nrepl-middleware
, so that is something outside shadow?
that means you are definitely NOT connected to the nrepl server shadow-cljs provides
so yeah. either configure the nrepl middleware or connect to the shadow-cljs server
confirmed that I can connect using clj -Sdeps '{:deps {nrepl {:mvn/version "0.8.3"}}}' -m nrepl.cmdline --connect --host localhost --port 33333
, upgrade via (shadow/repl :my-app)
, so yeah, it seems like an nrepl connection issue. Thanks for taking a look, I’ll try to debug from here.