Fork me on GitHub
#shadow-cljs
<
2018-10-07
>
kanwei00:10:20

@thheller it hangs after calling shadow.cljs.devtools.server/start! via a boot task

peter00501:10:48

Iā€™m using shadow to deploy a production build that includes the library, re-frame-firebase. https://github.com/deg/re-frame-firebase. If I run with :optimizations :simple or :advanced, I get the following error.

------ WARNING #1 --------------------------------------------------------------
 File: firebase/app.cljs:1:14

 constant firebase assigned a value more than once.
Original definition at externs.shadow.js:6
--------------------------------------------------------------------------------
If I run with :optimizations :whitespace, I do not get any compile errors but the browser is not happy and I get
main.js:3157 Uncaught TypeError: Cannot set property 'Error' of undefined
    at main.js:3157
    at main.js:15494   Uncaught TypeError: Cannot read property 'main' of undefined
    at window.onload ((index):14)
goog.nodeGlobalRequire=function(path){return false};goog.provide("goog.debug.Error")
Any ideas on what is going on and how to resolve? TNX

thheller12:10:10

@kanwei no idea but the log you posted clearly shows that you have some dependency conflicts which may cause issues

thheller12:10:51

ie. version 1.3.0 + 1.3.1 of the linked lib are both on the classpath

thheller12:10:00

likely there are other conflicts

thheller12:10:32

@peter005 thats a warning not an error?

thheller12:10:51

do you have the cljsjs.firebase shim setup correctly?

bbss12:10:16

Hitting some weird issue with an undeclared warning, not sure if it's the cljs compiler or something in shadow-cljs.

bbss12:10:23

(go-loop []
  (let [[[request-spec preload started] result] (<! finished-requests)
        request-took-ms (- (.getTime (js/Date.))
                           (.getTime started))
        latest-ten (cons request-took-ms (take 9 @avg-processing-time-coll))
        avg-processing-time (/ (reduce + latest-ten) (count latest-ten))]
    (when (not preload)
      (do (aset result "took" (+ avg-processing-time 100))
          (js/postMessage result #js [result])))
    (recur)))

bbss12:10:33

Says result is undeclared.

thheller12:10:45

no idea. maybe core.async doesn't like the nested destructure?

bbss12:10:58

Sorry, I should edit that. The issue doesn't happen for this code exactly.

bbss12:10:49

With the data literal it gives the warning. Without it doesn't.

thheller12:10:32

I'm guessing core.async macro maybe gets confused?

bbss12:10:03

Yeah could be the go loop.

bbss12:10:13

163 |           (js/postMessage #js {:result result} (to-array [(aget result "data")]))))
----------------------------------------------^---------------------------------
Use of undeclared Var gsv.worker/result

thheller12:10:07

(js-obj "result" result) does that complain?

bbss12:10:22

Tried (js/postMessage (clj->js {:result result}) (to-array [(aget result "data")])) that works.

bbss12:10:49

didn't consider js-obj, that is less invasive probably. Trying that.

bbss12:10:00

Weird issue though! šŸ˜„

thheller14:10:25

@bbss I can reproduce this easily ... will see if its shadow-cljs or upstream

(go (let [a 1]
      (prn a)
      (prn #js [a])
      (prn #js {:a a})))

thheller14:10:39

warns about both #js uses

thheller14:10:58

probably core.async though, no issues without the go

thheller16:10:29

@kanwei maybe you are running into this https://dev.clojure.org/jira/browse/CLJ-2414. hard to tell since it seems to be working fine for me

thheller16:10:00

but the example specifically mentions sun.nio.fs.UnixPath and I'm on Windows so that might explain it

peter00523:10:12

@thheller Tnx for pointing me in the right direction. Shim needs some attention.