I have this config:
:modules {:viewer {:entries [nextjournal.clerk.sci-env
nextjournal.clerk.trim-image]}
:katex {:entries [katex nextjournal.clerk.katex]
:depends-on #{:viewer}
:exports {renderToString nextjournal.clerk.katex/renderToString}}}
(forgive the messed up layout due to copy pasting from the middle of an edn file)
This executes fine:
$ node build/viewer.js
but this won't:
$ node build/katex.js
file:///Users/borkdude/dev/clerk/build/katex.js:1
import { $APP, shadow$provide, $jscomp } from "./viewer.js";
^^^^^^^
What could be the issue here?When I manually add:
export { $jscomp };
to the output, no errors.ah in the changelog:
[ 07ef0 ] make :esm smarter about detecting if $jscomp is neededI'll try that update
yep, fixed.
Hi all. Anyone having issues working with shadow-cljs@3 and msw@2? After compilation, it asks me for the "utils" and other node modules. I solved this (or I believe so) by using :js-options {:keep-as-require #{"utils"} ... but then, when I require msw/node and it is empty {}. I have no idea what's going here tbh :(
Thanks @thheller... :target :browser-test I'm trying to run some unit tests. My library does some fetch calls to an API and I need msw (https://mswjs.io/docs/) to intercept those calls. I used shadow-cljs@2 and msw@1 long ago, I remember having uses but it worked.
Here is the current build, I removed the js-options:
:test {:target :browser-test
:test-dir "public/test"
:devtools {:http-port 8021
:http-root "public/test"}}
ok, so you are building for the browser but said you do a require for msw/node? The docs say there is a msw/browser require you are supposed to do? https://mswjs.io/docs/integrations/browser
import { setupWorker } from 'msw/browser' I mean. translated to cljs of course.
Yes, that would another option. As I mentioned, I used shadow and msw/node before, and it worked, so I was trying to follow same path but switching to shadow v3 and msw v2, something changed. I'm not sure which is it. What I can see is that packages like node-libs-browser won't be included anymore...
that is possible, but seems like the msw package is pretty clearly structured so that msw/node isn't supposed to work in the browser?
I mean its package.json explicitely disables the msw/node entry for the browser https://unpkg.com/msw@2.10.5/package.json
"./node": {
"browser": null,what keeps you from just switching msw/node to msw/browser like the docs suggest? or does that still have the same issue?
Ah, I see. Yeah it could be that msw/node is now forbidden on purpose.
Well, I was reluctant because I did it once so I was hoping to do a copy/paste from that previous work. I'll give msw/browser a try, things must be done a bit different I believe, but if I find issues I'll ask for help if that's okay. Thanks again @thheller
seems like you are building for the browser but trying to use a node only package?
no clue what msw is, so can't say for sure
:js-options {:keep-as-require #{"utils"} isn't really the solution either, that just tells shadow-cljs to not bundle it. but if any code actually wants to use it it would just fail at runtime (which I suspect is whats happening)
to give you a proper answer I need more info on what it is you are trying to do. what is your :target or better yet the entire build config