This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-01
Channels
- # announcements (1)
- # beginners (71)
- # calva (12)
- # cider (3)
- # clj-kondo (12)
- # cljsrn (9)
- # clojure (167)
- # clojure-dev (21)
- # clojure-europe (5)
- # clojure-italy (60)
- # clojure-nl (6)
- # clojure-spec (6)
- # clojure-uk (60)
- # clojurescript (86)
- # core-async (25)
- # cursive (21)
- # datascript (9)
- # datomic (4)
- # figwheel (8)
- # fulcro (7)
- # graalvm (4)
- # jackdaw (6)
- # jobs (8)
- # juxt (2)
- # leiningen (1)
- # malli (1)
- # off-topic (20)
- # re-frame (31)
- # reagent (5)
- # remote-jobs (3)
- # shadow-cljs (57)
- # sql (6)
- # vim (9)
If I had a macro like (defjson my-json "/some/path/to.json")
and that macro slurped in the json file at the path is there a way to tell shadow-cljs that when I change the file at "some/path/to.json" it should recompile the cljs file I've used the macro in?
I think you can't. why not write edn in a clojure file, that can be auto reload I think.
@colinkahn see https://clojureverse.org/t/using-none-code-resources-in-cljs-builds/3745. if you use that helper function it'll recompile. otherwise it won't
Hey, I’ve just asked a question on the new http://ask.clojure.org about source maps for react native in shadow-cljs - if anyone has any ideas or leads please chime in! https://ask.clojure.org/index.php/8294/there-approaches-source-maps-working-with-react-native-shadow
could you help me by setting up a very basic figwheel/react-native project that has an actual source mapped error? I can't seem to figure out how to get that working
ah sure, so the red box never shows anything - it’s only ever in chrome
let me see if I can set up a project
I’m using expo is that ok?
but should be ok with expo. if I get it to work there I can probably get it to work without
I’m trimming back one of our working projects; we diverged a fair bit from the template over time, might take a little bit of time. It’s quite informative to do so I’m glad to be doing it 🙂
(def styles
^js (-> {:container
{:flex 1
:backgroundColor "#fff"
:alignItems "center"
:justifyContent "center"}
:title
{:fontWeight "bold"
:fontSize 24
:color "blue"}}
(clj->js)
(rn/StyleSheet.create)))
(defn bad-press [e]
(js/console.log "pressed the bad button")
(throw (ex-info "button pressed" {})))
(defn root []
(react/createElement rn/View #js {:style (.-container styles)}
(react/createElement rn/Text #js {:style (.-title styles)} "Hello!")
(react/createElement rn/Button #js {:onPress (fn [e] (bad-press e))
:title "error"})))
I’ll put this up on git in a mo - it’s a bit rough around the edges apologies
just to double check - have you got “pause on caught exceptions” on
might just be that
ah brilliant ok
I’ve never seen the redbox show mapped sources
chrome seems to be ok - it’s just that particular example is called from react native code so there’s no other user/ code-mapped stack frames
oo have you got it working with shadow-cljs?
nice!
^ this is definitely working enough for me -
it takes it from being almost impossible to debug an error in a large project to being possible
what did you have to do to get it to work with shadow?
🙂 brilliant - am pumped about this 😄
@thheller thanks for link. I think I have a special case though because I’m using the :npm-module
target and while (r/inline "/my/path")
inlines the resource it doesn’t recompile the file i’m using it in when the resource changes during the watch. This does work for the :browser
target though.
A bit more info, i’m using the output from :npm-module
within storybook, but I’ve confirmed that it’s shadow not rebuilding the files by looking at the generated source in my out
dir
it should be starting a new compile? it certainly isn't limited to the :browser
target?
I see it compiling my :stories build, saying it has compiled 1 file. Can I run w/ a debug flag to see which file it’s compiling?
[:stories] Compiling ...
-> build target: :npm-module stage: :resolve
-> Resolving Module: :main
<- Resolving Module: :main (31 ms)
<- build target: :npm-module stage: :resolve (34 ms)
-> build target: :npm-module stage: :compile-prepare
<- build target: :npm-module stage: :compile-prepare (0 ms)
-> Compile CLJS: project/ui/stories/button_stories.cljs
<- Compile CLJS: project/ui/stories/button_stories.cljs (20 ms)
-> Cache write: project/ui/stories/button_stories.cljs
<- Cache write: project/ui/stories/button_stories.cljs (19 ms)
-> build target: :npm-module stage: :compile-finish
<- build target: :npm-module stage: :compile-finish (0 ms)
-> build target: :npm-module stage: :flush
-> NPM module flush: /Users/colinkahn/code/project-web/out/stories
<- NPM module flush: /Users/colinkahn/code/project-web/out/stories (34 ms)
<- build target: :npm-module stage: :flush (35 ms)
[:stories] Build completed. (412 files, 1 compiled, 0 warnings, 0.23s)