Fork me on GitHub
#shadow-cljs
<
2021-10-05
>
Oliver George03:10:40

Has anyone used @react-pdf/renderer with shadow-cljs?

Oliver George03:10:05

I'm trying to decide if my errors are compatibility or a setup problem.

Oliver George03:10:39

dynCall is not a function

thheller06:10:51

hard to diagnose without more info. pdfjs is notorious for not working properly with bundlers so I made this example using the CDN version https://github.com/thheller/reagent-pdfjs

thheller06:10:16

react-pdf seems to be using pdfkit. never tried that myself but maybe it has similar issues

Oliver George08:10:20

Thanks I’ll poke around a bit and see what sense I can make of it.

thheller16:10:25

there is no shadow-cljs.edn?

thheller17:10:20

checked it out. it appears that something in there requires some WASM code to be bundled. shadow-cljs currently can not do that

Oliver George19:10:06

Thanks. Good to see there's an escape hatch. Was worries I would need to completely pull shadow out.

Oliver George19:10:44

Sorry from missing the shadow config in the repro.

Oliver George09:10:27

Stack trace shown in console is:

TypeError: dynCall is not a function
    at Function.eval [as bind_value] (eval at buildCallerFunction (nbind.js:1), <anonymous>:1:96)
    at _nbind_value (nbind.js:1041)
    at module.exports (entry-common.js:241)
    at Object.shadow$provide.module$node_modules$$react_pdf$yoga$src$dist$entry_browser (entry-browser.js:41)
    at shadow.js.jsRequire (js.js:66)
    at Object.shadow$provide.module$node_modules$$react_pdf$renderer$dist$react_pdf_browser_cjs (react-pdf.browser.cjs.js:22)
    at Object.shadow.js.jsRequire (js.js:66)
    at Object.shadow.js.require (js.js:113)
    at eval (rpdf.ex2.js:2)
    at eval (<anonymous>)

myguidingstar11:10:41

how can I specify lein profiles for each shadow build?

thheller16:10:32

not supported. if you really must you can just use lein via lein with-profiles +whatever run shadow.cljs.devtools.cli release your-build or so

myguidingstar17:10:16

if run from npx, shadow seems to ignore :lein {:profile "+cljs"}?

thheller17:10:08

if thats in your build config then yes, otherwise should be fine if at top level

Aspirational13:10:45

Hey! I am trying to publish a chrome extension but I get a rejection because of code obfuscation, they provide an example of obfuscated code: out/background.js:null:null: n(null, 1, [js, new n(null, 7, [Xh How can I disable code obfuscation?

borkdude14:10:23

@dovganchin optimizations simple

🙌 1
thheller16:10:45

@dovganchin better to try shadow-cljs release app --pseudo-names or shadow-cljs release app --debug

thheller16:10:05

that'll still renamed and minify everything but give somewhat more usable names for stuff

💯 1
thheller16:10:33

you want to keep :advanced optimizations to keep the code small

myguidingstar18:10:46

is there a :target for Chrome Extension? I see that mentioned in Basic Workflow but can't find a section for that

ribelo18:10:55

:chrome-extension

ribelo18:10:35

I just don't know if it is still supported and nothing has gone wrong in the meantime

myguidingstar18:10:19

there seems to be an example at https://github.com/binaryage/chromex/tree/master/examples/shadow Not sure if it still works...

thheller18:10:21

the shadow-cljs part still works but I don't know what has changes regarding chrome extensions since then

thheller18:10:43

IIRC there is a new manifest format and stuff

Chris McCormick23:10:48

What do these errors mean when compiling in :esm target?

[:server] Compiling ...
[2021-10-06 07:09:53.234 - INFO] :shadow.build.npm/js-invalid-requires - {:resource-name "node_modules/keyv/src/index.js", :requires [{:line 18, :column 14}]}
[2021-10-06 07:09:53.501 - INFO] :shadow.build.npm/js-invalid-requires - {:resource-name "node_modules/express/lib/view.js", :requires [{:line 81, :column 13}]}
My requires look like:
["keyv$default" :as Keyv]
["express$default" :as express]