This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-31
Channels
- # announcements (4)
- # babashka (73)
- # beginners (128)
- # bristol-clojurians (1)
- # calva (8)
- # cider (8)
- # clj-kondo (4)
- # clojars (7)
- # clojure (148)
- # clojure-dev (16)
- # clojure-europe (5)
- # clojure-gamedev (1)
- # clojure-italy (10)
- # clojure-nl (7)
- # clojure-uk (57)
- # clojurescript (57)
- # clojutre (1)
- # community-development (2)
- # cursive (7)
- # data-science (1)
- # datascript (5)
- # datomic (9)
- # events (6)
- # figwheel-main (1)
- # fulcro (91)
- # garden (11)
- # graalvm (14)
- # graphql (1)
- # immutant (4)
- # jobs (1)
- # kaocha (33)
- # off-topic (63)
- # onyx (3)
- # pathom (4)
- # re-frame (23)
- # ring-swagger (1)
- # shadow-cljs (49)
- # sql (6)
- # testing (8)
- # tools-deps (45)
- # vrac (1)
- # xtdb (10)
Try to compile into es6 by setting the argument in your shadow-CLJS.edn file
(Maybe update to 2.83?)
@jmckitrick that is caused by you using project.clj or deps.edn and not having the correct closure-compiler version (ie. dependency conflict). you need to resolve this, you should have
[com.google.javascript/closure-compiler-unshaded "v20191027"]
[org.clojure/google-closure-library "0.0-20191016-6ae1f72f"]
[org.clojure/google-closure-library-third-party "0.0-20191016-6ae1f72f"]
I think its time I write this down somewhere ... getting tired of repeating it ... why does everyone insist on using lein/deps.edn?
(note that the version changes between shadow-cljs versions, so if you have one pinned you must make sure it matches) ... or just use shadow-cljs.edn ....
deps.edn allows local libraries or git libraries
Hi! In JS I can do const logo = require('../../media/logo.svg');
and then use logo
as html (e.g. in React's dangerouslySetInnerHTML={{ __html: logo }
). What to people do in Cljs / shadow? I guess it is not supported to require
a non-cljs resource. Thank you!
Answered here https://clojurians.slack.com/archives/C03S1L9DN/p1580473104024800?thread_ts=1580472004.023600&cid=C03S1L9DN
@U05224H0W I have been searching the Dev Guide for how to embed non-code resources but couldn't find anything. Is shadow.resource/inline
not mentioned there or have failed to search well?
Perhaps "Table 1. ES6 Import to CLJS Require " could be extended to point to a description of this as people use in JS import/require for non-code resources?
Or add a section between 12.2 and 12.3 (12.25 :)) called "Embedding resources from files"?
the require('../../media/logo.svg')
pattern is something from webpack and not supported by shadow-cljs in any way
Wouldn't it work also for CSS? I.e. anything text-based? IF it was an image I guess I would also need to run it through base64 and thus write my own include macro anyway?
yes and no. in the case of webpack it will collect all the required css files and then create one final css file with all of them combined
the images in general it usually just returns the path and copies to actual file to the path it returned
ok, thank you!
I’m perfectly happy using a better method, as long as I can build an uberjar with the result. Is there a better way?
I had removed the shadow code from the project.clj, but put it back for building the uberjar.
@jmckitrick shadow-cljs release app && lein uberjar
would be my recommendation. I really don't see the point lein
doing everything but some people prefer that.
Hmm, that’s what I was doing.
Let me try again, and post the results here.
~/d/b/bank1 ❯❯❯ shadow-cljs release app ⏎ master ✱
shadow-cljs - config: /Users/jmckitrick/devel/bank/bank1/shadow-cljs.edn cli version: 2.8.69 node: v13.7.0
shadow-cljs - running: lein run -m shadow.cljs.devtools.cli --npm release app
NPM version conflict for "react" in deps.cljs (will use A)
A: "16.8.6" from jar:file:/Users/jmckitrick/.m2/repository/re-frame/re-frame/0.10.9/re-frame-0.10.9.jar!/deps.cljs
B: "16.9.0" from jar:file:/Users/jmckitrick/.m2/repository/reagent/reagent/0.9.0-rc3/reagent-0.9.0-rc3.jar!/deps.cljs
NPM version conflict for "react-dom" in deps.cljs (will use A)
A: "16.8.6" from jar:file:/Users/jmckitrick/.m2/repository/re-frame/re-frame/0.10.9/re-frame-0.10.9.jar!/deps.cljs
B: "16.9.0" from jar:file:/Users/jmckitrick/.m2/repository/reagent/reagent/0.9.0-rc3/reagent-0.9.0-rc3.jar!/deps.cljs
[:app] Compiling ...
IllegalArgumentException: No matching field found: getSourceName for class com.google.javascript.jscomp.JSError
as I said before. you are running through lein
. so YOU must ensure that the shadow-cljs
version in project.clj gets the matching closure-compiler
version it expects
from the looks of it you actually have a newer version of shadow-cljs in project.clj, not .69
.
Ok, let me fix that.
But I wasn’t using lein
there…
I used it for setup
I see… lein true
BUT then you must move your dependencies and source-paths into shadow-cljs.edn as well
Ok, I think that’s the next step. I thought it was solved when I just deleted the shadow keys from project.clj
I will come back to this. As long as I know I can get an uberjar for prod deployment, I can revisit the topic later.
Thanks for you help, meanwhile!
The build did get farther, but broke looking for the correct namespace. I assume that’s what you were referring to, with setting up shadow-cljs.edn correctly with dependencies and paths.
I think I’ll start over, and begin with reading the manually entirely 😉
Are there any examples or articles on building :chrome-extension with shadow-cljs? I couldn't find any so far. Thanks!
@rberger this is all that exists in terms of docs https://github.com/thheller/shadow-cljs/issues/279
Thanks, saw the issues but will check out the fulcro-inspect, that should help... Also want to thank you so much for shadow-cljs. It really makes Clojurescript work wonderfully! Really helped in allowing us to take advantage of things like AWS Amplify: https://dev.to/rberger/aws-amplify-and-clojurescript-re-frame-part-1-3d3f