Fork me on GitHub
#shadow-cljs
<
2020-04-04
>
David Pham06:04:56

Did you guys manage to enable pretty print with cider and shadow-CLJS?

hindol07:04:05

What does this error mean? There are 29 of these in total.

------ WARNING #1 -  -----------------------------------------------------------
 Resource: 
 Failed to resolve sourcemap at out/cljs/pprint.js.map: out/cljs/pprint.js.map
--------------------------------------------------------------------------------
I was earlier using shadow-cljs.edn for dependencies and it was throwing the same set of warnings but still worked. Now I moved dependencies to deps.end and it stopped working entirely.
;; deps.edn
{:paths ["src"]
 :deps  {cljs-http            {:mvn/version "0.1.46"}
         reagent              {:mvn/version "0.10.0"}
         re-frame             {:mvn/version "0.12.0"}
         re-frame-utils       {:mvn/version "0.1.0"}
         thheller/shadow-cljs {:mvn/version "2.8.94"}}}

;; shadow-cljs.edn
{:builds   {:app {:asset-path "/js"
                  :modules    {:app {:init-fn com.github.hindol.twenty-nine/init}}
                  :output-dir "public/js"
                  :target     :browser
                  :http-root  "public"
                  :release    {:output-dir "../docs/js"}}}
 :deps     true
 :dev-http {3000 "public"}}
All the warnings started after I added re-frame-utils to the mix. I kind of need the FX and COFX stuff from the library. I am willing to copy those functions over if there is no easy fix.

David Pham08:04:14

Did you require the cljs.pprint namespce anywhere in your code?

hindol08:04:27

Yes, I have [clojure.pprint :as pp] in a couple of places. There are a bunch of other errors (total 29 of them, all same type of warning),

------ WARNING #21 -  ----------------------------------------------------------
 Resource: 
 Failed to resolve sourcemap at out/reagent/debug.js.map: out/reagent/debug.js.map
--------------------------------------------------------------------------------
------ WARNING #22 -  ----------------------------------------------------------
 Resource: 
 Failed to resolve sourcemap at out/reagent/dom.js.map: out/reagent/dom.js.map
--------------------------------------------------------------------------------

hindol08:04:45

So, I think somehow this is some dependency conflict.

hindol08:04:40

Can I see a dependency tree with shadow?

thheller08:04:04

my guess is that the re-frame-utils lib contains some compiled code it shouldn't

thheller08:04:10

and that confuses the compiler

hindol08:04:36

Will you be kind enough to take a quick look at it?

thheller08:04:23

I did and yes it contains a bunch of files it shouldn't contain

hindol08:04:42

Any pointers? I am willing to fork it and fix it.

thheller08:04:43

0 Thu Oct 05 10:21:04 CEST 2017 out/reagent/
 10627 Wed Jul 26 16:37:12 CEST 2017 out/reagent/core.cljs
 33164 Wed Jul 26 16:37:12 CEST 2017 out/reagent/core.cljs.cache.edn
 30952 Wed Jul 26 16:37:12 CEST 2017 out/reagent/core.js
 12618 Thu Oct 05 10:21:04 CEST 2017 out/reagent/core.js.map
   614 Wed Jul 26 16:37:12 CEST 2017 out/reagent/debug.cljs
  2007 Wed Jul 26 16:37:12 CEST 2017 out/reagent/debug.cljs.cache.edn
  2864 Wed Jul 26 16:37:12 CEST 2017 out/reagent/debug.js
  1150 Thu Oct 05 10:21:02 CEST 2017 out/reagent/debug.js.map
  2702 Wed Jul 26 16:37:12 CEST 2017 out/reagent/dom.cljs
  7765 Wed Jul 26 16:37:12 CEST 2017 out/reagent/dom.cljs.cache.edn
  6720 Wed Jul 26 16:37:12 CEST 2017 out/reagent/dom.js
  3362 Thu Oct 05 10:21:04 CEST 2017 out/reagent/dom.js.map

thheller08:04:04

the out folder shouldn't be included in the distributed .jar file

hindol08:04:24

That will be a change in the project.clj? I don't see how that is being included in the jar.

David Pham08:04:33

I would copy the two files

David Pham08:04:38

Directly into my code base

David Pham08:04:09

There are two namespaces and only rely on re-frame and reagent [also the test maybe].

hindol08:04:01

I wanted to fix it because re-frame FAQ links to it. Others may experience the same issue. https://github.com/day8/re-frame/blob/master/docs/FAQs/UseASubscriptionInAnEventHandler.md#solutions

thheller08:04:50

yeah I would just copy the source files into your project and remove the dependency

thheller08:04:09

the files are there because the development output files weren't deleted before publishing, so they get published with it.

hindol08:04:53

Okay, that's an easy fix then. Will open a ticket in the repo.

hindol08:04:29

Should have checked that first.

thheller08:04:30

normally shadow-cljs has protections against those files. dunno why they don't work

hindol09:04:03

It did work, even with the warnings. When I moved to deps.edn, it stopped working.