This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-17
Channels
- # admin-announcements (17)
- # announcements (1)
- # aws (8)
- # beginners (5)
- # boot (125)
- # cider (28)
- # clojure (33)
- # clojure-berlin (21)
- # clojure-italy (1)
- # clojure-japan (1)
- # clojure-nl (12)
- # clojure-poland (90)
- # clojure-russia (120)
- # clojurescript (284)
- # clojurex (2)
- # cursive (6)
- # datomic (14)
- # devcards (4)
- # events (2)
- # funcool (2)
- # hoplon (238)
- # ldnclj (32)
- # off-topic (27)
- # onyx (9)
- # re-frame (3)
- # reagent (22)
I’m getting an error in my console: Error loading file <my file.js>
figwheel.client.utils.log.cljs$core$IFn$_invoke$arity$2/f() utils.js:104
figwheel.client.utils.log.cljs$core$IFn$_invoke$arity$2() utils.js:117
figwheel$client$utils$log() utils.js:71
figwheel$client$file_reloading$reload_file/<() file_reloading.js:218
cljs.core.apply.cljs$core$IFn$_invoke$arity$2() core.js:12142
cljs$core$apply() core.js:12110
<anonymous> file_reloading.js:158
goog.async.Deferred.prototype.fire_() deferred.js:649
goog.async.Deferred.prototype.updateResult_() deferred.js:298
goog.async.Deferred.prototype.errback() deferred.js:339
goog.net.jsloader.load/script.onerror()
What does figwheel_server.log
say?
Yeah, it looks like it’s compiling the CLJS ok and notifying the browser that the JS has changed.
and theres still the same error?
if you refresh the page?
These are my versions of things:
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.122"]
[figwheel "0.3.6"]
[figwheel-sidecar "0.3.6"]
[reagent "0.5.0"]]
:plugins [[lein-cljsbuild "1.1.0"]]
You’re trying to do https://github.com/bhauman/lein-figwheel/wiki/Running-figwheel-in-a-Cursive-Clojure-REPL right?
I wasn’t able to get it to run with newer lein-cljsbuild. I have:
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.122"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[figwheel "0.3.6"]
[figwheel-sidecar "0.3.6"]]
:plugins [[lein-cljsbuild "1.0.5"]]
you’ve cleaned?
weird, not working for me either now
@mfikes: I understand that React on the Native Android will work without the webview?
@dnolen: by now I’m convinced this is a bug in ClojureScript: http://dev.clojure.org/jira/browse/CLJS-1452
@a.espolov: wouldn't be native if it didn't ; d
@a.espolov: well, React Native is not native code as well, it's still Javascript
@a.espolov: see https://github.com/nicholaskariniemi/ReactNativeCljs for proof of concept using React Native
@pupeno: you need to create a reproduction that doesn’t use Leiningen
@danielcompton: that’s not what the documentation says: https://github.com/clojure/clojurescript/wiki/Reporting-Issues
@pupeno: oh sorry, I thought you were using cljsbuild too
my bad
Does anybody else feel they are constantly having to prove that they Googled and tried the basic stuff, that they read the documentation, that they researched the problem and so on? I don’t know if this is normal for everybody or I have a way of communicating that causes this (English is not my native language and even in my native one, I tend to speak in a different way to most people). (@danielcompton this is not an attack at you, just a general observation)
@pupeno: I understand what you’re saying, I think the reason for all of the steps and checks is that there’s a lot of moving parts between ClojureScript, Leiningen, Figwheel, e.t.c. so things need to be reduced right down to bare clojurescript to make sure the issue is there. It also means that the people who investigate bug reports don’t need to do this work themselves.
@danielcompton: oh, yeah, I understand that. I’m also the recipient of bug reports for my own software. That’s not really what I’m whining about 😉
it's missing cljs.jar but if you download that and put it in the root dir then it's "react-native run-android", "./watch.sh", "react-native start"
then off to see how mfikes and others used om on the iOs side, should be pretty straightforward
mmmm. Probably if you substitute your windows equivalents for those commands. watch.sh just runs a java command
(from this quick start page https://github.com/clojure/clojurescript/wiki/Quick-Start)
When Figwheel reloads code, is there an idiomatic way to stop it from blowing away component state? (A reload seems to call init-state
on each component.)
@pupeno please do not report issues that involve third party tooling. If you are going to report something it should be done only with ClojureScript and nothing else. The length of our conversation yesterday (and my inability to replicate anything on my end) is the reason for this.
@pupeno while I know you may be frustrated with this particular issue and may be even be discouraged also realize that I’ve been working through issues just like this one with people for ~3 1/2 years only to discover after much research that the issue was not actually in ClojureScript.
@dnolen: I reported the issue following the documentation on how to report issues. WTF?
@pupeno pleae be very careful with your tone. you reported an issue on how to reproduce with Lein, Only report issues via ClojureScript.
@dnolen: the documentation on reporting issues says that I should use lein, just not cljsbuild, which is what I did.
Yes, it is very frustrating to spend a couple of hours to figure out how to build a minimal reproduction of a bug following the instructions on how the project wants to report bugs only to be told I’m doing it wrong.
@pupeno ah, right sorry I forgot at some point someone (perhaps even I added) that. I’ve since forgotten since I try to get people do issues with cljs.jar
which eliminates more variables. Let me just remove that section entirely.
Ok. I’m not here to bother you. I’m spending time in reporting the bug because I like ClojureScript and I’d like it to get better. I also looked at the source code trying to see if I could fix it but got nowhere.
the page needed updating is all, it was very misleading as to what we’re willing to look at these days.
Where can I download the 1.7.122 uberjar?
Ah, ok.
Thanks.
Mh… with 1.7.48, my minimal example compiles fine. I know with .107 and .122 it’ll fail, but with master, I get this error: Exception in thread "main" java.lang.IllegalArgumentException: No implementation of method: :-compile of protocol: #'cljs.closure/Compilable found for class: nil, compiling:(/Users/pupeno/Downloads/nnn/src/nnn/core.clj:5:1), like it’s not finding the clojurescript file.
Ah… there’s a different api.
@pupeno you should be using cljs.build.api/build
not the private cljs.closure/build
btw, minor thing
Yeah, just noticed. Changed that, but still the same error.
Fixed that.
Yeah, it seems to be gone from master.
It was present on .107 and .122 though.
Oh well.
Good idea.
It’s not happening with the 122 tag for me.
@a.espolov: I cannot help you with that sorry. I would look to see what other people have done around bootstrapping.
@pupeno stuff like this is why we don’t take issues involving Lein. This is just not reproducible w/o whatever Lein / plugin combination you have.
@dnolen: cljs.js-deps/load-library
is looking at each library files separately when loading them, right?
What I mean is as far as I can tell anything lower in the call stack than cljs.js-deps/load-library
is not aware of the whole set of libraries, just one particular file of one library
@dnolen: is there code in public access to this article? http://swannodette.github.io/2015/07/29/clojurescript-17/
@dnolen: yes, I understand. Interestingly enough, using lein (not cljsbuild), .48 works, .108 and .122 fail, but master works again. So even though the bug might be in lein, a change in ClojureScript was triggering it.
I have a project, using the reagant template. When I use Figwheel with intellij as it is descriped on their github page, the figwheel server is started, but not the ring server. So the website isn’t shown. How can I debug the starting process, to find the error?
@jaen it’s really probably worth having this discussion with @maria as to where it’s best for this logic to go.
you might want to send her an email about what you’re trying to do, I’m sure she could point you in the right direction that dovetails w/ what she has already done
@pupeno: I looked at the changelog and I did’t see any interesting compiler changes that might be related to the issue.
I figured it would be best to have something to show for it before I start bothering people more, but sure I might as well do it now.
@jaen: I think so! It would be great to have another person familiar with the module bits of the compiler
with the cljs bootstrap work, is it (becoming) possible to embed a repl in a node.js app?
is there a good way to monkeypatch something in clojurescript? Especially before some concrete namespace loads up?...
this thing worked for me for a while:
(ns mk.monkeypatch
(:require [datascript]))
(defn conn? [conn]
(and #?(:clj (instance? clojure.lang.Atom conn)
:cljs (satisfies? cljs.core/ISwap conn))
(datascript.core/db? @conn)))
#?(:cljs (set! datascript/conn? conn?))
but now something changed and it loads after namespace which uses this functionas I suspected the primary use case so far is embedding in browser or use cases not already well served by Clojure itself (i.e. Planck, mobile)
@asolovyov: well that’s kind of yucky (but you probably already know that). Sounds like to me that dependency order was violated somehow?
@dnolen: yeah, and I can't find where. I just moved my main view from being in mk.index.views into mk.router and it died.
I wonder if it's because they are somehow somewhere loaded in a weird order? but I can't find where it can be, I looked at main.js (which is my first namespace) and the order is good...
@dnolen: nice, i'll try. are you aware of examples that specifically do this already (repl embedding)?
@asolovyov: is this in production or under development or both? (I’m assuming you are using ClojureScript >= 1.7.48)
argh, I'll just move monkeypatching to main namespace, because it's going to be easier
@asolovyov: in the browser Google Closure does the loading
@asolovyov: hrm … so I think this may be ClojureScript’s fault let me look
(moving into main ns doesn't help since router loads before any code is executed :-))
@asolovyov: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/compiler.cljc#L1018
Hah, interesting, I thought I was imagining things at some point when dependencies were not resolved as I expected.
When I target node and compile with no optimizations, the generated file doesn’t have the hashbang line, #!/usr/bin/env node, but when I have simple optimizations it is added. Any ideas why?
I don't think GClosure preserves comments, maybe it treats is a comment and chucks it out?
@pupeno: what @jaen said, pretty sure it wouldn’t make it through GClosure compilation
I’m not that familiar with the GClosure workflow (I suffered earlier versions of it when working in GMail and never looked back at it). Does GClosure only run for non-optimized outputs?
dnolen: the hashtag is present only when optimizations are present, and absent otherwise.
@pupeno yes this is a patch that someone submitted long ago that adds it for convenience to optimized builds when using :target :nodejs
Yes, I read that documentation. Is it intended that non-optimized builds don’t have the hashbang? the documentation doesn’t say it or I missed it.
Got it.
I’ll submit the ticket, not sure if I can make the patch but I’m looking into it.
cool, thanks, but yeah low hanging fruit like this generally doesn’t get fixed unless someone submits a patch
Shall I make a note in the documentation so the next person doesn’t get surprised?
I’ll make a note in the bug report.
I marked it as minor, not sure if it’s minor or trivial.
argh, I got the formatting wrong. Is ClojureScript’s jira not allowing editing bug reports?
Thanks.
Contributor Agreement http://clojure.org/contributing
Ah, nope.
Last time I did this was for the Asterisk project and we were required to fax it… yes fax. 😛
@dnolen: I have a potential fix, but I have two questions. Should I run some tests to make sure I didn’t break anything? Are github pull requests welcome or should I send a patch?
@pupeno if you haven’t already found this page https://github.com/clojure/clojurescript/wiki/Developers
Thank you.
Patch sent.
@tjg: figwheel reloads will erase local state. I just wrote a post which proposes a strategy to avoid this problem in Reagent http://vvvvalvalval.github.io/posts/2015-09-16-bottup-approach-to-reagent-state.html
@tjg if you're using Om or plain old React I believe it would not be too hard to implement a similar strategy
@val_waeselynck: Haha, wow thanks, I'll read this now!
@val_waeselynck: @tjg please see https://github.com/bhauman/cljs-react-reload it contains a strategy for maintaining local state across reloads, this method should really be integrated into frameworks
But you can also just use it to create a react class that maintains local state for whatever you are working on
@bhauman: awesome
deployed lein-figwheel 0.4.0. Change log: https://github.com/bhauman/lein-figwheel/blob/master/CHANGES.md
I understand that correctly using cljs/eval-str in the ns declaration cannot add dependency namespace that uses a macro?
@a.espolov: bootstrapped ClojureScript isn’t different from ClojureScript, you need to use :require-macros
or :refer-macros
Hm, if there's cljs syntax highlighting in stable Chrome then I guess that means cljs-devtools should also work in it
I have a legacy app that is using :optimizations :whitespace
to join a lot of disparate namespaces into one file. For development speed I'd like to switch to :optimizations :none :main 'app.core
. Is there a good way of dynamically inserting dependencies into a namespace?
@spinningtopsofdoom: I’m not sure what you mean
if you mean real dynamic require after page load that isn’t possible without leaning on an existing REPL (standard, Figwheel, etc.)
For example having namespaces app.foo
and app.bar
be required by namespace app.core
without having to require them like (ns app.core (:require [app.foo] [app.bar]))
I figured you'd need a REPL for that, thanks
@spinningtopsofdoom: you can create different top level namespaces for different builds that include the libs you want in that context.
btw the screenshot I just posted is after I upgraded figwheel... don't know what's happening, but upon reload I get this error
@borkdude: this awesome thing - https://github.com/binaryage/cljs-devtools - it used to require beta channel to run, but cljs highlighting was introduced after the version cljs-devtools required, so it should be working then too
@bhauman: ah, luckily it wasn't an error, I honestly don't know why chrome put a breakpoint at that point in the code
after seeing that Metosin talk about clojure pearls it occurred to me I should've used fnil much earlier: ((fnil string/lower-case "") nil) ;;=> ""
@bhauman: Do you have an idea what might be causing the figwheel error I’m seeing with the Cursive tutorial setup?
Figwheel: Error loading file exception_viewer/core.js utils.js:104:8
figwheel.client.utils.log.cljs$core$IFn$_invoke$arity$2/f() utils.js:104
figwheel.client.utils.log.cljs$core$IFn$_invoke$arity$2() utils.js:117
figwheel$client$utils$log() utils.js:71
figwheel$client$file_reloading$reload_file/<() file_reloading.js:218
cljs.core.apply.cljs$core$IFn$_invoke$arity$2() core.js:12142
cljs$core$apply() core.js:12110
<anonymous> file_reloading.js:158
goog.async.Deferred.prototype.fire_() deferred.js:649
goog.async.Deferred.prototype.updateResult_() deferred.js:298
goog.async.Deferred.prototype.errback() deferred.js:339
goog.net.jsloader.load/script.onerror()
@cfleming: first of all you need to make sure you clean before upgrading and to make sure you are not connecting to an older version of figwheel running in the browser
@cfleming: when you get a chance let me know which setup you are referring to I'm happy to help. You gonna be at Strange Loop?
@bhauman: This is with a new project I just set up yesterday following that tutorial. I’ve cleaned and reconnected from a new browser tab. I got this on both 0.3.6 and 0.4.0.
@cfleming: my guess is that you are getting a 404 when requesting the file from the browser. Look in you dev console at requests and see if this is the case.
@cfleming: you may have hit several things at once. changing versions can be tough if you don't clean or if your browser is caching old code.
OK where are you serving your compiled assets from? file system? app server? figwheel server?
@danielcompton Was seeing the same error yesterday, perhaps it’s 0.3.6 problem?
I’ll upgrade my real project to 0.3.9, clean and reload everything, if I’m still seeing the problem I’ll check the 404.
@danielcompton: I don't know. but there are problems when people switch versions and leave the browser open or don't clean
@cfleming: is there any chance that Cursive is messing with the dependencies?
@danielcompton: Anything is possible and Cursive does do that, but a new project with 0.3.9 works for me now.
I’m going to try migrating my real project to 0.3.9 and cleaning everything to see if that works.
@cfleming: 0.4.0 should work as well but you have to manually put piggieback in the new :figwheel {:nrepl-middleware ["piggie ..."]}
@bhauman: I’m following https://github.com/bhauman/lein-figwheel/wiki/Running-figwheel-in-a-Cursive-Clojure-REPL
working for me now too
Maybe it was a Thursday bug
Ok, it’s now working for me too - that is totally weird. I’ll upgrade to 0.4.0 and clean everything out.
PEB2CAK
Problem exists between 2 keyboards and chairs
I was having the same issues yesterday, but working fine today ¯\(ツ)/¯
I suspect Cursive
Just for good measure make sure that your cleaning operation is actually deleting the compiled assets and make sure that your browser isn't caching
@danielcompton: I can’t deny the possibility
This isn’t a figwheel specific issue at all, but why do Leiningen projects need to be cleaned so often? Is there a root issue that means that caches aren’t invalidated? It’s not like cache invalidation is very difficult or anything
getting following JS errors in browser when using figwheel: Uncaught SyntaxError: Unexpected token var Uncaught SyntaxError: Unexpected end of input along with other random ones. They are pointing to defcomponent calls in the sourcemaps which are part of om-tools
@danielcompton: its that we like having fast compilation times, CLJS does a great job of only writing the files that need to be written and reusing files that have already been compiled. but there is still room for improvement. Figwheel currently runs in a mode that is less safe with :recompile-dependents false
for much faster compile times.
I see. But when I update a dep in a project and restart a build process, shouldn’t that invalidate all of the existing compiled files?