This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-13
Channels
- # announcements (5)
- # babashka (35)
- # beginners (65)
- # braveandtrue (3)
- # calva (20)
- # cider (6)
- # clara (11)
- # cljs-dev (36)
- # cljsrn (64)
- # clojure (65)
- # clojure-europe (6)
- # clojure-germany (13)
- # clojure-italy (14)
- # clojure-nl (22)
- # clojure-spec (16)
- # clojure-sweden (6)
- # clojure-uk (81)
- # clojurescript (71)
- # conjure (120)
- # cursive (3)
- # datomic (10)
- # events (4)
- # figwheel (4)
- # figwheel-main (5)
- # fulcro (36)
- # ghostwheel (1)
- # graalvm (8)
- # helix (9)
- # jobs (4)
- # jobs-discuss (12)
- # kaocha (33)
- # leiningen (5)
- # luminus (1)
- # off-topic (24)
- # pathom (7)
- # rdf (4)
- # re-frame (3)
- # reagent (15)
- # reitit (11)
- # remote-jobs (1)
- # shadow-cljs (97)
- # slack-help (3)
- # spacemacs (23)
- # vim (15)
- # xtdb (35)
I’m using the re-frame template where shadow-cljs is integrated within lein’s project.clj
. Anytime I run lein dev
something is running npm install --save --save-exact [email protected] [email protected]
which is deleting all my deps I added in package.json
How can I install an npm dependency without it getting deleted?
@thheller Ah thanks. I’ll use shadow-cljs.edn
We've just made changes to address these concerns here - https://github.com/day8/re-frame-template/issues/128#issuecomment-627903960 @thheller @caleb.macdonaldblack
hello, i have run into a weird situation. when i run my shadow-cljs compiled SPA on iOS 9 Safari, the first time the page loads it doesn't run the main.js
. if i change the code it live-reloads it successfully. i narrowed the problem down to a single dependency, which if i eliminate it, this problem goes away. has anybody ever seen anything like this and have any suggestions?
i seem to have solved this with a very small wrapper called zxingwrap.js
:
module.exports = {
"lib": window["RTCPeerConnection"] ? require("@zxing/library") : null,
};
when i do this and then require ["zxingwrap" :as zx]
i can then use zx/lib.InstanceName
and it works great on both platforms. Very curious. Any ideas as to why this works I would love to hear them!the dependency is @zxing/library
- https://github.com/zxing-js/library
@chris358 impossible to tell without more info. you should get an error when you load the page. that error will tell you whats wrong. just look at the browser console?
unfortunately i cannot look at the browser console on this device. i tried catching window.onerror
but got nothing.
i do not have a mac osx computer
all i have is a safari 9 tablet and the greatest software development tooling known to humankind
it's ok, this workaround is fine for now and nobody else in the world has a safari 9 ipad
hmm. yeah thats rather old. you can try :compiler-options {:imul-js-fix true}
in your build config
there used to be a rather old iOS bug with Math.imul
. thought nobody was using version that was affected by that anymore
thank you, will try this!
Hi all. I’m having trouble getting devcards working with shadow-cljs and wondering what I’m doing wrong. I’m a novice, so apologies if this is obvious to others. I’ve added devcards and shadow-cljsjs to my deps.edn, but the build continues to complain failed to load devcards.system.js ReferenceError: React is not defined
. Is there something obvious I’m missing? Thanks in advance!
@mjacobus for some reason devcards does not declare its dependency on React so in the namespace where you require devcards first require cljsjs.react
don't need to add shadow-cljsjs manually btw. shadow-cljs already depends on it so it will be available regardless.
Thanks! I’ve been wrestling with that for a while. Really appreciate the quick reply. Very nice of you.
It looks like same situation with ReactDOM.
Yes, thank again.
I get the following error when I start shadow-cljs. I get it for the two versions that I have tried: 2.8.58 and the latest one. Any hint?
Syntax error (NoSuchFieldException) compiling . at (shadow/build/closure.clj:68:5).
getRegisteredGroups
when using project.clj/deps.edn you must ensure that you get the correct shadow-cljs + clojurescript + closure-compiler versions
@thheller Sorry but I have tried everything and I still get the error. I moved my code to the latest version of shadow and clojurescript:
org.clojure/clojurescript {:mvn/version "1.10.758"}
thheller/shadow-cljs {:mvn/version "2.9.2"}
you should be getting [com.google.javascript/closure-compiler-unshaded "v20200504"]
?
This might be the problem:
com.fulcrologic/fulcro 3.2.3
cljsjs/react-dom 16.13.0-0
com.cognitect/transit-cljs 0.8.256
com.cognitect/transit-js 0.8.846
org.clojure/clojurescript 1.10.597
org.clojure/google-closure-library 0.0-20170809-b9c14c6b
org.clojure/google-closure-library-third-party 0.0-20170809-b9c14c6b
org.mozilla/rhino 1.7R5
com.google.javascript/closure-compiler-unshaded v20180805
are you sure you have the dependencies declared in the correct spot? with the correct profiles?
ooops, really sorry, I used the wrong alias. I indeed have the right closure version: com.google.javascript/closure-compiler-unshaded v20200504
Unless I am missing something, I think so. My shadow-cljs.edn starts as follows:
{:deps {:aliases [:dev]}
And in deps.edn I have:
:dev {:extra-paths ["src/test" "src/dev" "src/workspaces"]
:jvm-opts ["-XX:-OmitStackTraceInFastThrow"]
:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.758"}
thheller/shadow-cljs {:mvn/version "2.9.2"}
that should be fine. The error you see is 100% caused by an incorrect version on the classpath. maybe some old AOT classes or something?
ok, thanks anyway for your help. I’ll try to investigate more, especially with regard to the classpath then.
Cannot assign to read only property 'exports' of object '#<Object>'
at Module.<anonymous> (main.1d63ab3fd8c0aad6bcda.bundle.js:5638)
at Module../out/cljs_env.js (main.1d63ab3fd8c0aad6bcda.bundle.js:5639)
at __webpack_require__ (runtime~main.1d63ab3fd8c0aad6bcda.bundle.js:849)
run into this when using :npm-module
with webpack before?I was able to get an example shadow-cljs + storybook v5 project up and running here: https://github.com/Lokeh/storybook-cljs
I could fix the export issues so that only exported things are visible in dev as well
@thheller it might be worthwhile highlighting that shadow-cljs is sensitive to things like clojurescript
/ closure-compiler
versions? Just looking at the github readme I don’t see anything obviously there that prompts me to dig in and work it out. I only really clocked it when you told me when I was having problems =)…
Perhaps a warning + link to a section in the user guide (if that exists) talking through it in more detail?
Sorry, it’s just most libs you just require and go, so it’s not something the average clojure dev knows to look for =)…
but everyone wants to stick with lein or deps.edn so you shadow-cljs can't fix those issues for you
Is there a way to use git deps and/or private repos with shadow without deps.edn? IIRC that was the reason we switched to deps
I think that would be useful, as I can imagine wanting to put things like fixtures inside of the story as well
I ran into one other puzzling thing where occasionally webpack would throw an error about reloading goog.math.Long
at runtime
I believe it was due to starting the shadow-cljs compile process after storybook. I would guess this was causing a reload of all of cljs.core
+ google closure library
@lilactown just released 2.9.3. storybook should no longer see non-exported defs
Is there any bug with core.async? I am using 2.9.2 and the latest core.async version, for nodejs and the server complain that take!
is not defined.
/.shadow-cljs/builds/app/dev/out/cljs-runtime/cljs/core/async/impl/ioc_helpers.cljs:52
(defn take! [state blk ^not-native c]
^
TypeError: c.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 is not a function
For the error message...
I use it on a sliding buffer?
ahh oops
I am idiot
guess coding at 23:15 is not optimal 🙂
How did you know it would be that mistake by the way?
well the ^not-native
hint makes the compiler use the "direct" call to the take! protocol impl instead of going through the dispatch method
thanks
^not-native
is a compiler optimization. it gains a bit of performance but loses a better error message in the process 😉
new thing I added in the new release
$ shadow-cljs server
shadow-cljs - config: /mnt/c/Users/thheller/code/tmp/error-test/shadow-cljs.edn
shadow-cljs - starting via "clojure"
--- SHADOW-CLJS FAILED TO LOAD! ----------------------
This is most commonly caused by a dependency conflict.
When using deps.edn or project.clj you must ensure that all
required dependencies are provided with the correct version.
You are using shadow-cljs version: 2.9.3
The important dependencies are:
org.clojure/clojure "1.10.1"
org.clojure/clojurescript "1.10.758"
com.google.javascript/closure-compiler-unshaded "v20200504"
Please verify that you are loading these versions.
You can find all required dependencies here:
Please refer to the Guide for more information:
-----------------------------------------------------
The error encountered was:
Syntax error compiling at (shadow/cljs/devtools/api.clj:1:1).
at clojure.lang.Compiler.load(Compiler.java:7647)
at clojure.lang.RT.loadResourceScript(RT.java:381)
at clojure.lang.RT.loadResourceScript(RT.java:372)
at clojure.lang.RT.load(RT.java:463) ...
hopefully provides some help when using the wrong dependency versions via deps.edn or project.clj
so if we do not specify tthe dependencies, we should be fine?