This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-23
Channels
- # announcements (3)
- # babashka (68)
- # beginners (297)
- # calva (13)
- # cider (4)
- # clj-kondo (8)
- # cljs-dev (10)
- # cljsrn (26)
- # clojure (100)
- # clojure-europe (4)
- # clojure-germany (1)
- # clojure-italy (9)
- # clojure-nl (5)
- # clojure-spec (9)
- # clojure-uk (41)
- # clojurescript (69)
- # conjure (70)
- # cursive (44)
- # data-science (20)
- # datascript (2)
- # datomic (55)
- # emacs (1)
- # exercism (3)
- # graalvm (2)
- # kaocha (11)
- # leiningen (6)
- # meander (9)
- # mental-health (1)
- # off-topic (73)
- # pathom (6)
- # pedestal (1)
- # re-frame (3)
- # reagent (52)
- # reitit (8)
- # rum (39)
- # shadow-cljs (152)
- # spacemacs (10)
- # tools-deps (28)
- # xtdb (5)
I'm trying to js/require a json but I can't figure out which path the js/require is starting at, how can I find out?
mhm maybe it doesn't make sense looks like I got the path right as it works for images, for instance (js/require "../resources/images/ui/welcome.jpg")
works but (js/require "../resources/images/ui/fleets.json")
doesn't
I'm unable to load the kaocha repl using (use 'kaocha.repl) in my shadow-cljs repl. I have added it in the dependencies like so:
:dependencies [[lambdaisland/kaocha "1.0-612"]]
But upon doing (use 'kaocha.repl), I get:
Error in phase :compilation
Only [lib.ns :only (names)] and optionally `:rename {from to}` specs supported in :use / :use-macros; offending spec: [kaocha.repl] at line 1 cljs/user.cljs
Why is this?just not into testing that much. mostly do stuff with the REPL and then sometimes write a test to automate
@thheller I’ve got a css generated from outside the directory of where I’m working using SASS. The generation works fine, but shadow-cljs does not reload. When I manually edit the generated CSS file shadow-cljs reloads. Any idea on how to solve this?
you mean if you edit the generated file it reloads but it doesn't reload when it is generated?
check if the file last-modified timestamp is changed when that generates a new file?
hmm yeah dunno. might be something internal from the filewatcher that it doesn't like things going back in time?
If so, could be that one that doesn’t report a changed file since it’s backwards in time. Ie, a previous version?
I have a RN app with minimal shadow-cljs config and it compiles as I expect. Auto load is not working however and I’m not sure where to look, does anybody have any ideas?
# shadow-cljs.edn
{
...
:builds {:dev {:target :react-native
:init-fn env.main/main
:output-dir "target/dev"
:devtools {:autoload true
:after-load my.core/print-debug-stmt}
...
}
@thheller It’s included in the regular build, it’s actually the fn that registers the root app component but I just changed names for it here 😄
did you keep a reload mechanism like this one? https://github.com/thheller/reagent-react-native/blob/master/src/main/test/app.cljs#L33-L59
I even tried putting (println "ABC")
in the top level of my.core
that’s printed only the first time the app is loaded but not after edits and recompiles
Exception in thread "async-dispatch-9" java.lang.IllegalArgumentException: No implementation of method: :close! of protocol: #'clojure.core.async.impl.protocols/Channel found for class: clojure.lang.PersistentArrayMap
at clojure.core$_cache_protocol_fn.invokeStatic(core_deftype.clj:583)
at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:575)
at clojure.core.async.impl.protocols$eval256$fn__257$G__245__262.invoke(protocols.clj:21)
...
These are my deps
:dependencies [[binaryage/devtools "1.0.0"]
[com.andrewmcveigh/cljs-time "0.5.2"]
[com.cognitect/transit-cljs "0.8.256"]
[com.rpl/specter "0.13.1"]
[cljsjs/libphonenumber "8.10.18-0"]
[orchestra "2017.07.04-1"]
[expound "0.5.0"]
[org.clojure/test.check "0.9.0" :scope "test"]
[pjstadig/humane-test-output "0.8.1" :scope "test"]
[re-frame "0.11.0-rc3"]
[reagent "0.9.0-rc4" :exclusions [cljsjs/react-dom
cljsjs/react
cljsjs/react-dom-server
cljsjs/create-react-class]]
[day8.re-frame/test "0.1.5" :scope "test"]]
dunno. what does the device log have to say? likely that it just fails to connect to the shadow-cljs server? happens if it can't find the correct IP to use?
I add a line (println "something-new")
and can see that "something-new"
appears in index.js 😄
Not getting any device logs when recompiling, do you want me to look for anything special in the logs that are printed on startup? I can’t find anything interesting but maybe I’m missing something
I mean can you open http://192.168.1.208:9630 on your device browser?
This project has been running on for almost 4 years now so there’s likely a bunch of old dependencies and setup that might get in the way
Hello everyone, I’m new to shadow-cljs and ClojureScript. I was curious if there is a command that audits your dependencies for new available releases, and if there’s a command to update dependencies as well? Thanks for all the help!
there is not (yet) a command for that no if you are using shadow-cljs.edn
only. lein or deps.edn have options for that.
Question for anybody who uses cljs-devtools (https://github.com/binaryage/cljs-devtools) I just added it to my basic reagent/re-frame project deps.edn
{:paths ["src"]
:deps {thheller/shadow-cljs {:mvn/version "2.8.94"}
binaryage/devtools {:mvn/version "1.0.0"}
reagent {:mvn/version "0.10.0"}
re-frame {:mvn/version "0.12.0"}}}
shadow-cljs.edn
{:deps true
:builds {:app {:target :browser
:output-dir "public/out"
:modules {:app {:entries []
:init-fn
:devtools {:http-root "public"
:http-port 8020}}}}
and now I’m getting a bunch of console warnings along with my page no longer rendering
failed to load shadow.module.app.append.js TypeError: alpha_journal.app.render is not a function
at Object.alpha_journal$app$main [as main] (:8020/js/cljs-runtime/alpha_journal.app.js:15)
at eval (:8020/js/cljs-runtime/shadow.module.app.append.js:4)
at eval (<anonymous>)
at Object.goog.globalEval (app.js:836)
at Object.env.evalLoad (app.js:2224)
at app.js:2414
DevTools failed to parse SourceMap:
...
I was following the cljs-devtools example (https://github.com/binaryage/cljs-devtools/tree/master/examples/shadow) for shadow-cljs and it seems like I didn’t need to explicitly set a :preloads
or anything.
Thanks for any help 🙂check the first error? alpha_journal.app.render is not a function
this is likely the result of something else failing before it
@thheller :face_palm: thanks, accidentally slurped my render function into another function. That fixed my rendering issue, but now I’m still getting the sourcemap parsing failures:
DevTools failed to parse SourceMap:
DevTools failed to parse SourceMap:
DevTools failed to parse SourceMap:
DevTools failed to parse SourceMap:
DevTools failed to parse SourceMap:
DevTools failed to parse SourceMap:
...
I didn’t explicitly require any DevTools package in my main file. Is that a possible problem?
app.cljs
(ns
(:require
[reagent.core :as r]
[reagent.dom :as dom]))
no you shouldn't have a direct require for it anywhere. thats already taken care of just by including it in your dependencies
is the path correct? I mean what do you get when you open http://localhost:8020/js/cljs-runtime/goog.debug.error.js.map manually?
I get a blank page and console output as:
Failed to load resource: the server responded with a status of 404 (Not Found)
app.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
app.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
DevTools failed to parse SourceMap:
DevTools failed to parse SourceMap:
Sorry I’m a bit lost on the path situation. I’m seeing my page render on http://localhost:8020/, but if I follow the sourcemap warning link (ex. http://localhost:8020/js/cljs-runtime/goog.async.workqueue.js.map) I get a blank page and in the console, I get that output that I wrote above
what is your :output-dir
? what is your :asset-path
? what is the path you are loading your JS from in your HTML?
Hmm don’t believe I have those explicitly set. This is my shadow-cljs.edn
{:deps true
:builds {:app {:target :browser
:output-dir "public/out"
:modules {:app {:entries []
:init-fn
:devtools {:http-root "public"
:http-port 8020}}}}
and my index page is loading from <script _src_="out/app.js" _type_="text/javascript"></script>
which I believe is correctso you need to add :asset-path "/out"
(right after :output-dir
) since that defaults to /js
Awesome, so if I understand correctly, when I have a custom :output-dir
I should remember to set my :asset-path
(otherwise it uses the default path which is wrong)
That seemed to clear up most of my sourcemap warnings. I just have a preload and postload warning?
don't know what those are? are you working on a browser extension? those errors come from a browser extension?
Got it. Turned out Adblocker causes those warnings. If anyone else runs into the same thing, I just removed my adblocker extension.
@thheller thanks for all the help! Much appreciated 🙂
I was curious though if you could elaborate a bit on what :entries
does. Some of the config keys have been confusing me since I’ve been following a lot of tutorials and examples but a lot of them have very different config layouts in their shadow-cljs.edn. Thanks!
entries is the namespaces that should be included in the module (your build basically)
Awesome, thanks for the clarification. Helps a lot
is there a way to import a cljs library from a github repo instead of a maven repo? I need to patch the https://github.com/ckirkendall/kioo library
@lilactown deps.edn
won't work. the lib has no deps.edn
.
you’re right, I didn’t think of that. if they’re forking it anyway, it’s easy to add one
I use lein project.clj and shadow-cljs.edn