This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-19
Channels
- # admin-announcements (2)
- # beginners (24)
- # boot (36)
- # business (1)
- # cbus (3)
- # cider (22)
- # cljs-dev (91)
- # clojure (101)
- # clojure-canada (9)
- # clojure-china (3)
- # clojure-czech (21)
- # clojure-nl (3)
- # clojure-russia (131)
- # clojure-sg (5)
- # clojure-uk (9)
- # clojure-ukraine (4)
- # clojure-za (2)
- # clojurebridge (18)
- # clojurescript (333)
- # clojurex (6)
- # devcards (1)
- # events (37)
- # hoplon (15)
- # ldnclj (23)
- # luminus (3)
- # off-topic (41)
- # om (258)
- # onyx (20)
- # re-frame (46)
- # reagent (7)
- # spacemacs (2)
Has anyone been getting a stackoverflow error from "lein cljsbuild auto". I can usually get "lein cljsbuild once" to work, but auto seems to fail every time. Seems it doesn't like my "go-loop"
{:error
#error {:message "Could not eval ", :data {:tag :cljs/analysis-error}, :cause #error {:message "Cannot read property 'findInternedVar' of null at line 1 ", :data {:file nil, :line 1, :column 1, :tag :cljs/analysis-error}, :cause #object[TypeError TypeError: Cannot read property 'findInternedVar' of null]}}}
can’t figure it out from looking at the source (https://github.com/clojure/clojurescript/blob/r1.7.145/src/main/cljs/cljs/js.cljs#L762-L806) and dnolen’s example (https://github.com/swannodette/swannodette.github.com/blob/cljs-next/code/blog/src/blog/cljs_next/core.cljs)
hey guys, a little question. I'm using a figwheel repl and cider (or cursive) to attach to that, all good. But as soon as I send a file over to the repl, figwheel compiles into a different folder (`./out/`) instead of the one I told it to (`./app/js/out/`). This only happens when I use the repl
project.clj is available here https://github.com/dvcrn/dmedit/blob/master/project.clj. Did I set something up the wrong way?
@dvcrn probably something related to your builds. Try adding :figwheel true
to the build maps?
(you probably want the node and frontend build to output to different dirs as well, I can imagine them trying to overwrite each other with reckless abandon)
ah so the stuff that is getting built is the node build? I assume launching the repl through (cljs-repl)
is ignoring the other options because the main figwheel window is telling me Focusing on build ids: frontend
ah hrm, seems like it https://github.com/bhauman/lein-figwheel#scripting-figwheel.
the sidecar API wants something like :build-ids ["dev"]
are macro/function names with a leading dot officially supported? like (defmacro .’ []…)
i’m trying to compile reagent with cljs-bootstrap, but the compiler translates the name .’
to ._SINGLEQUOTE_
, which is incorrect and gives javascript errors
@settinghead: I think supported names for macros are the same as for symbols here http://clojure.org/reader
@ul: ah thanks!
think i’ll file an issue for the reagent authors
@jr0cket: silly question but did you open a browser and connect to localhost:3449 ? That looks like figwheel waiting for a browser connection, once you open the browser figwheel connects to the browser based repl and shows repl prompt.
@agile_geek its not a silly question, but yes we did connect with the browser
@jr0cket: cool. That’s me out of ideas then 😉
@bhauman: @agile_geek - yes, I was kind of assuming that the tutorial had one or more old dependencies in it. I'll probably stick with the Om & Om next tutorials for now as I explore the new (to me) world of React
Since upgrading to El Capitan my clojurescript app reports an error in the Safari error console: [Error] SyntaxError: DOM Exception 12: An invalid or illegal string was specified. cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped Anyone see this? It works in Chrome still just fine...
@bensu I do indeed: [:button.close {:data-dismiss "modal" :dangerouslySetInnerHTML {:html "×"}}]
@kestrel7: well, your answer is probably there, specially if the code snippet you shared is inside a go macro. Check if that property ×
works with the updated Safari.
hey guys, little question; is it possible to conditionally require a library to a namespace in Clojurescript? I've found this-> http://stackoverflow.com/a/29452022/3417023 for clojure but it doesn't seem to work in cljs
I didn't try it, but I imagine you could split your application into modules - there's a simple example here http://swannodette.github.io/2015/02/23/hello-google-closure-modules/ - and then asynchronously load code the module as needed. But I didn't need this so far, so I don't know how it works in practice.
@anmonteiro: I wouldn't recommend going there. In general require
is not supported (there is a JIRA ticket for it)
if your use case is to use a dev vs production starting point (as described in the SO question) there are other options
ooookay
thanks 😛
@anmonteiro: conditional require at runtime is not possible, it needs to happen at compile time to make :advanced
compilation possible.
@bensu I’ve tried removing the ‘dangerously set’ call but I still get the same problem. However I now understand from you that the problem is some invalid DOM manipulation. Thanks for the pointer. Any idea as to how to get the actual value of the illegal string?
@kestrel7: not really. It looks like some of your React views is doing something that breaks Safari inside a go macro. So I would remove views until the error goes away. It sounds like a lot of work, but you have a very fast feedback loop when you use figwheel
anyone aware of any effort to apply a code reduction tool other than Closure Compiler? specifically something written in Node.js and/or Clojure/Lisp only?
@settinghead: not that I'm aware of. I would probably advise against it: the ClojureScript compiler is very much geared to produce code for the Google Closure Compiler and work with it's libraries, idioms, and module system. Whatever build step you put after the ClojureScript compiler would need to take that into account.
@settinghead: I'm not aware of any other such tool that can do dead code elimination as the Closure Compiler can. other "minifiers" don't even come close.
Was wondering the other day: why are modules not compatible over different compile cycles? (e.g. common library & app specific modules)
afaik that’s because there will be different renamed/minimized variable names but that seems like something that could be worked around?
@martinklepsch: that doesn’t seems possible to me due to code motion
@martinklepsch: you are not only dealing with renames, you are also dealing with cross module motions and functions being removed/kept alive
@dnolen: @thheller, right assuming that module contents are narrow/specific enough I forgot to add
@bensu @thheller @dnolen thanks. i've been trying to get ClojureScript to work in Meteor platform (which is node.js based). ideally i'd like to be able to initialize the entire code optimization process from node.js. now that Closure Compiler seems unavoidable, i think a compromise might be something like https://www.npmjs.com/package/closurecompiler
I think I have been using closure modules longer than anyone else in cljs and never had a case where that would have been possible
I tried very hard though .. I was convinced that it would be possible in the beginning
Seems to me that in a browser context it would be very handy to have two artifacts, one for rarely changing stuff one for often changing stuff, think I might have even discussed this with @dnolen before
i looked at the codebase the other day, and seems that it's doable if i re-write this file (make it .cljc
by adding node logic that uses the library above): https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj
does this look like a sensible approach to you?
@settinghead: that thing just wrap the JVM Closure Compiler
yes i understand that
@martinklepsch: yes that seems handy, but it does not work.
@settinghead: we’re not adding any more Node.js support beyond what we already have
@settinghead: cljs.jar is a thing, it’s invokeable from the command line
every release provides a jar containing everything to run ClojureScript (besides a JVM of course)
@dnolen: i came across it but i didn't realize it does code optimization too. i'll give it a try. thanks
@settinghead: if you’re new to ClojureScript read the Quick Start, it covers operation via cljs.jar
@dnolen: if that's quick to answer, I've tried to see if my code keeps working under advanced optimisations, but it blows up due to nil
value for source
here - https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L1678-L1680
I'm not sure what's the reason there is different resolution logic for no-opts vs. opts (there must be some, I guess), but with opts it means that cljs-source-for-namespace
is used and due to it using io/resource
it only sees thing on the classpath and adding the folder with sources to classpath should fix it, am I getting that right?
Heh, it was both that and the fact that I somehow had dashes and not underscores in the directory name. But it's interesting how it didn't manifest in a non-optimised compilation.
@jaen: can you send me the react sources after they have been processed by the commonjs->closure stuff? I gave up quite fast after seeing what npm
does .
Not yet, since that requires me to write a custom module loader, which I once did in a spike, but didn't yet write that in the clean version.
and would be interested in what (process-libs/process-js-libraries lib-opts)
produces ... not more
You can read https://github.com/jaen/custom-module-loaders/blob/master/src/clj/process_libs.clj if you want
yeah node_modules/thing/node_modules/other/node_modules/even/node_modules/more/node_modules
But this one should work - https://github.com/jaen/react-with-modular-cljs
@bhauman: I was thinking a that in browser Figwheel thing would be kinda cool, maybe very little to do?
kinda thinking the DevCards UI is a great way to get people to learn ClojureScript in the browser
well was just thinking about doing my Om Next blog post entirely as DevCards interface
Should be useful for demonstrating component options, like re-com demo does.
there is a fledgling api for rendering individual namespaces https://github.com/bhauman/devcards/blob/master/src/devcards/core.cljs#L991
I wrote a node script for my blog which prerenders the page/ns and spits it out with front matter
@jaen: thanks! it sort of works ... https://github.com/thheller/react-test/blob/master/src/cljs/react_test/app.cljs
too bad Closure doesn't recognize "production"!==process.b.a
as something it can remove
Though maybe that's because you prepended the node env thing and I put it in the script
tag
dnolen suggested an alternative might be sugaring on the compiler side instead of generating better module names
I’m concerned that React is moving to a world where you must build via their NPM based tooling to get anything done
in anycase the more important part is a strategy for dealing with React that doesn’t involve NPM
I would not be surprised if 1 year from now React starts discouraging using the standalone scripts they provide
once React gets really popular (they’re almost there) they have more freedom to dictate how to consume it
Mine's still compiling, I'm on a wooden PC ATM; let's see if React+Reagent work in advanced, at least for simple example
well prepending process.env.NODE_ENV
was manual, there are probably more things like that in there
Hmm, I'm still getting Cannot read property 'c' of undefined
over here, even with the preamble
Here's my branch of cljs compiler - https://github.com/jaen/clojurescript/commit/46d7fc2e068e139c5ba15dcdbdfe961d21ca6cd7
(cljs.build.api/build
"test-project/src/cljs"
{:main "custom-module-loaders.core"
:output-to "test-project/out/custom-module-loaders.js"
:output-dir "test-project/out"
:optimizations :advanced
:verbose true
:asset-path "out"
:preamble ["test-project/preamble.js"]
:libs [{:root "test-project/node_modules/react"
:name "react"
:files ["react.js" "addons.js" "lib/"]
:main "react.js"
:module-type :commonjs}]})
shadow-build
would be a bit too complex for me now, I'd have to deal with lein and whatnot
My first spike had this - https://github.com/jaen/custom-module-loaders/blob/master/build.sh - which is not really a feasible thing to do xD
If you want to try it add [org.clojars.jaen/reagent "0.5.2-SNAPSHOT"]
to your project.clj
(ns react-test.app
(:require [module$react$react :as React]
[reagent.core :as reagent]))
(defn increment-button [counter text]
[:button {:on-click (fn [e]
(swap! counter inc)
(.preventDefault e))}
text])
(defn test-component []
(let [counter (reagent/atom 0)]
(fn []
[:div {:style {:color "red"}}
[:p "Test: " @counter]
[increment-button counter "Click me!"]])))
(reagent/render [test-component] (.-body js/document))
But I imagine it probably exercises enough of reagent so it won't break with a bigger project, at least without optimisations
@dnolen: yeah, I think I remember mfikes saying something to that effect, though I imagine ReactNative will bring more problems with it, since it has native modules and whatnot
@thheller: I think cljs outputs only the files you depend on and those I sent you were outputted without reagent; give me a second
@dnolen: that bug is probably the most difficult one so far IMHO. It was just staring you in the face for a few months, laughing invisibly. :)
@thheller: hm, no, the sources I've sent you were from a build with reagent; and I've just compiled it in your project without a problem (that is just adding my reagent fork and the sample code), so I'm not sure what can be wrong on your end.
@bhauman: especially if it is kind of a earthship like yours 😄
@bhauman: after hearing your speeches I realize I would never get anything done, laugh, and goof around 😄
TypeError: null is not an object (evaluating 'ReactBrowserEventEmitter$$module$react$lib$ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue')
@jaen: you cannot say Jawa in this channel lol
went pretty well, definitely need to figure out how to talk about Om Next to beginners
I feel kinda weird doing something like Om Next for my thesis, I feel like I'm incredibly late to the party now ; f
@jaen fixed it .. I removed [module$react$react :as React]
since the namespace doesn't use it
my dream would be to have a complete dev UI, devcards at the bottom of the page and a repl on the left
or better right
that is why I am working on the repl part, thanks to Mike's work
@bensu: the fear is well founded, I'm afraid, I don't think anyone in their right mind would call me sane; but even if I'm afraid I'm too late I still have to do it so they don't throw me out of the university, so in half a year there just might be two libraries
but I think that is what breaks the advanced compilation. what did you do to reagent?
React doesn't really seem to work as well when not using the React
object, since for example render functions don't get wrapped with their perf middleware (which happens on building that object and so on)
Has anyone else used Polymer with clojurescript?