This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-11
Channels
- # announcements (1)
- # aws (2)
- # beginners (140)
- # boot (67)
- # cider (50)
- # clojure (64)
- # clojure-berlin (1)
- # clojure-conj (1)
- # clojure-france (2)
- # clojure-italy (2)
- # clojure-nl (8)
- # clojure-norway (6)
- # clojure-seattle (1)
- # clojure-spec (81)
- # clojure-sweden (2)
- # clojure-uk (131)
- # clojurescript (147)
- # clojutre (7)
- # cursive (40)
- # datomic (34)
- # editors (5)
- # emacs (7)
- # events (9)
- # figwheel (18)
- # figwheel-main (1)
- # fulcro (2)
- # instaparse (1)
- # jobs (3)
- # leiningen (1)
- # luminus (10)
- # lumo (1)
- # mount (6)
- # off-topic (12)
- # pedestal (4)
- # portkey (7)
- # re-frame (8)
- # reagent (21)
- # reitit (10)
- # ring-swagger (5)
- # shadow-cljs (140)
- # specter (4)
- # tools-deps (53)
- # uncomplicate (1)
Does anyone have experience using https://github.com/vvvvalvalval/scope-capture with shadow?
I am looking into using it and seems that the way shadow does things might not work with what scope-capture wants to do
I'm trying to use this cljs wrapper for React. https://github.com/dmohs/react-cljs And, when I publish as npm, I get an error "ReferenceError: createReactClass is not defined". Maybe this library is not a good one to use with shadow-cljs but does anyone have experience with this library? or any good React wrapper that works with shadow-cljs?
yes there are ways. I'm just trying to understand why you are not using the default way.
https://github.com/thheller/shadow-cljsjs/blob/master/src/main/cljsjs/create_react_class.cljs
if you do it you must ensure that you do it before including it before any of the library code since it may try to access it directly
so thats a limitation of the library. since it shouldn't use the global in the first place
well its a self imposed problem due to hiccup-style which I personally got rid off for the most part due to overhead
you can call (reagent.core/as-element [your {:hiccup "stuff"}])
and that will return a react element
so if you need a "component" (defn ^:export my-component [props] (r/as-element [...]))
https://github.com/reagent-project/reagent/blob/master/src/reagent/core.cljs#L106-L124
https://github.com/reagent-project/reagent/blob/master/src/reagent/core.cljs#L61-L67
if you upgrade to 2.6.7
and run shadow-cljs server
and open
you can see the shadow-cljs UI preview I'm working on
this is written in fulcro and the code is here: https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/ui/app.cljs
I mostly do this nowadays https://github.com/thheller/shadow/wiki/shadow.markup
eg. https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/ui/style.cljs
personally I find this more pleasant to work with than hiccup style https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/ui/pages/build.cljs#L112-L146
Is there a way to set goog.global to empty js-object at compile time. I'm trying to compile advanced and my regex replace hook won't cut it then.
I think shadow or something uses it to write to it, it if's just an empty object it will work.
you can do it in a hook although it won't be pretty (as there is no official API for this yet)
If I regex replace before optimization, should I spit the result to a disk or change the build-state object that I return?
(update-in build-state [:output [:shadow.build.classpath/resource "goog/base.js"] :js] str/replace ... ...)
4wiw, this is a snippet that calls goog.global for example
//iter.js
goog.iter.StopIteration = ('StopIteration' in goog.global) ?
// For script engines that support legacy iterators.
goog.global['StopIteration'] :
{message: 'StopIteration', stack: ''};
@thheller Is it possible to use the :closure package provider for only some of the npm dependencies, that are known to survive advanced compilation?
say react is compatible but some react-lib you are using is not. react-lib would call the non-optimized react and go boom
I made a short video preview for the UI work I've been doing recently if someone is interested https://www.youtube.com/watch?v=gyqzLE1VU0s
Does shadow-cljs support anything like Leins checkout dependencies? https://goo.gl/UajWqf
@codonovan you can just add the :source-paths
to your config manually. otherwise no.
if you just add the usual dependency but also add the source path the files from the source-path will be used over the files in the jar
I'd totally missed the Leiningen integration part in the docs, reading through that now 🙂
Hello, I'm using shadow-cljs with fulcro for my app. I've started experimenting with Gatsby (https://www.gatsbyjs.org/) to generate the static pages for my app (login/registration/landing-page/pricing etc), which I write in JavaScript. The idea is to have a static page as the entry point to the application, instead of the server rendered html I currently have. I thought perhaps I could just build my clojurescript app as an npm module (like described here: https://shadow-cljs.github.io/docs/UsersGuide.html#_convenience_mode) and it does seem to almost work, I can import it from node_modules in gatsby -- but when I try to mount it I just see the application for a brief instant and then it disappears -- and then I get a bunch of errors in the console: Uncaught ReferenceError: clojure is not defined
in var G__15382__$1 = (((G__15382 == null))?null:clojure.string.replace(G__15382,/[#\*_^\-\
\[\]=>~]/,""));` and similar errors. Could someone point me in the right direction from here to make it work? Also, I don't know if building an npm module is even the right approach here, I'm just experimenting a bit.
@pontus.colliander can you tell which file fails? the file may just be missing the require for clojure.string
ie. is the file calling (clojure.string/replace ...)
directly or (str/replace ...)
via an alias
@codonovan another way is using deps.edn
, you can use :local/root
and point directly to the folder, this way you get source paths and depencies
IME lein checkouts + cljs don't play nice together
@wilkerlucio how come? I have been using checkouts with cljs code since basically the beginning of my cljs work?
you did? every time I tried that it always got the wrong deps, but I'm talking about figwheel times, I guessed that since the classpath calculation is the same (from lein) it would be the same results, but maybe shadow does something different?
glad to hear it works on shadow, I might try again sometime 🙂
@thheller Hey, I tried out these recommendations and it didn’t seem to work still, same problem highlighted here https://github.com/vvvvalvalval/scope-capture/wiki/Pitfalls-with-(browser-connected)-ClojureScript-REPLs#constraints-to-abide-by, no codesite
, I will try to push a clean template that replicates the issue soon.