Fork me on GitHub
#shadow-cljs
<
2020-08-01
>
steveb8n05:08:47

Q: I’m running a shadow-cljs browser app inside Salesforce. Using one type of integration it loads/works great. Using another I get “shadow-cljs - failed to load 34” in the console. I can see from the generated js that this is loading the npm pdfjs module. Unfortunately that is where the trail ends for me. I can’t work out why it won’t load even when I use the debugger in the fn that calls shadow.provide for that dep - it never seems to invoke that fn

steveb8n05:08:23

even stranger is that in the first type of integration, it never calls that provide fn either but the app works ok

steveb8n05:08:42

is there a way of looking deeper into these kinds of load errors?

steveb8n05:08:46

FYI: the integration that works is a Lightning Component and the one that fails is a Lightning Web Component. That doesn’t mean anything to cljs devs but I mention it for completeness

steveb8n05:08:21

Hmm: I was able to catch an error in the browser debugger “”Cannot assign to read only property ‘URL’ of object ‘[object Object]’“”

steveb8n05:08:59

I suspect the Salesforce browser security is suppressing something needed by shadow when loading the pdfjs dep

steveb8n06:08:36

but I can’t figure out how to stop it from calling this code…

thheller08:08:11

doesn't look like you can stop it. at least I see no flags or anything to do so.

steveb8n09:08:13

Yeah, I think you are right. Seems like some webpack trickery. I have way around it I can try. Thx

timrichardt05:08:38

@thheller Thx! Anyway, I'll let you know, when I figured something out.

Saikyun09:08:04

@thheller re: absolute cljs source path -- I'm transforming source code at the bottom of my namespace (so it runs whenever the namespace is loaded). it's only used for source I'm working on myself. an alternative way of getting the source code would be fine as well 🙂

thheller09:08:43

so you just want to slurp the file?

thheller09:08:14

slurp with (io/resource the-file) should do it

Saikyun09:08:17

where the-file is a relative path?

Saikyun09:08:31

that seemed to do it, thanks!

adamrenklint12:08:56

Q: is the compiler option :dump-core (https://cljs.github.io/api/compiler-options/dump-core) not supported in Shadow CLJS? It’s not listed in https://shadow-cljs.github.io/docs/UsersGuide.html#compiler-options as either supported or not, and it seems the option is not forwarded to the compiler. Is this intentional? Can I affect this through my build settings somehow?

adamrenklint12:08:30

Found the answer in https://clojurians-log.clojureverse.org/shadow-cljs/2019-07-07, that this compiler flag is not supported, and we’re supposed to use :target :bootstrap, which doesn’t seem to work (https://clojurians.slack.com/archives/C6N245JGG/p1596225051349100).

thheller13:08:04

:target :bootstrap works just fine. just some namespaces seem to cause problems. you don't have to precompile them though either. :dump-core wouldn't do that either.

thheller13:08:52

you can just use :entries [cljs.core] which would be equiv to :dump-core