Fork me on GitHub
#shadow-cljs
<
2020-06-28
>
Nolan00:06:15

im thinking i must have botched a dependency version or something somewhere along the line, but just upgraded to [email protected] with:

{:deps   {:aliases [:cljs]}
 :builds {:browser {:target :browser ,,,}}}
and i cant seem to figure out why this is happening:
$ shadow-cljs watch browser
...
CompilerException Unexpected error macroexpanding if-ns at (cider/piggieback.clj:22:1). #:clojure.error{:phase :macroexpansion, :line 22, :column 1, :source "cider/piggieback.clj", :symbol if-ns}
...
Caused by:
NoSuchFieldError ES3
is this looking familiar to anyone? i imagine i need to update piggieback or something like that, but i havent been able to crack it...

Nolan00:06:30

it seems pinning the com.google.javascript/closure-compiler-unshaded version to the same version in the shadow-cljs/deps.edn file eliminates that issue, but fails the build with:

[:browser] Build failure:
RuntimeException: No such resource: js/es6/util/createtemplatetagfirstarg.js

Nolan00:06:48

huh—removing the org.clojure/clojurescript entry in the deps.edn (i.e. not setting the clojurescript version explicitly) fixed the rest of the issues. apologies for the noise. will leave in case others stumble

sova-soars-the-sora13:06:13

Is there a rule of thumb for what vars to earmark as ^:export ?

dpsutton14:06:52

my understanding is that you only need to mark vars which you need to call from outside cljs and therefore need a stable and predictable name

dpsutton14:06:19

so not a rule of thumb. you either have a requirement to mark it as export to be able to know its name or your don't have that requirement

sova-soars-the-sora14:06:38

Ohh interesting. Cuz some of my variables are getting munged and "cannot call ab of undefined" and such when I used :advanced So ^:export probably won't help there

sova-soars-the-sora14:06:13

I figured it would preserve var names but yeah why would that be a problem if it had them all saved in a table or w/e

dpsutton14:06:27

does it work under no optimizations but fails under advanced?

dpsutton14:06:24

ah. i think the recommendation is to use :pseudo-names true in your compiler options for your build

dpsutton14:06:51

> You can use shadow-cljs release app --debug to enable both temporarily without touching your config. This is very useful when running into problem with release builds

sova-soars-the-sora14:06:15

Hmmm. I still get cannot call undefined.. pardon the Red

thheller14:06:47

@sova use shadow-cljs release app --debug

thheller14:06:57

thats source maps + pseudo-names

thheller14:06:05

much easier to identify where the actual issue is

thheller14:06:37

:export you only need for things you are calling by name from the HTML or so. not required for anything else and never fixes any other naming issues.

sova-soars-the-sora14:06:03

Ah, if I want to call a function() from the javascript / html side I use :^export

sova-soars-the-sora14:06:20

okay I will try with release app --debug and see

sova-soars-the-sora14:06:02

yeah it works with no optimizations, awesome-O, but creates a 2.1 mB file so ... would be nice to shave that down a tad.

dpsutton14:06:40

shadow-cljs release app --debug uses advanced optimizations. it sets :pretty-print and :pseudo-names to true to help you diagnose problems like these

dpsutton14:06:56

> :pretty-print and :pseudo-names default to false. You can use shadow-cljs release app --debug to enable both temporarily without touching your config. This is very useful when running into problem with release builds

sova-soars-the-sora14:06:46

awesome.. thanks guys... mmm it seems like it comes down to my hydrate code. I wonder if I could post it in code-review