This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-11
Channels
- # architecture (3)
- # beginners (41)
- # boot (7)
- # cider (16)
- # cljs-dev (8)
- # cljsrn (2)
- # clojure (214)
- # clojure-austin (4)
- # clojure-russia (52)
- # clojure-spec (8)
- # clojure-taiwan (1)
- # clojure-uk (10)
- # clojurescript (87)
- # cursive (14)
- # datascript (34)
- # datomic (11)
- # dirac (55)
- # emacs (12)
- # hoplon (44)
- # luminus (6)
- # lumo (24)
- # off-topic (1)
- # om (8)
- # onyx (7)
- # overtone (2)
- # pedestal (1)
- # protorepl (4)
- # re-frame (7)
- # reagent (1)
- # ring (4)
- # rum (2)
- # slack-help (1)
- # spacemacs (2)
- # specter (32)
- # unrepl (131)
- # untangled (14)
- # yada (3)
@johnnyillinois you want to set an absolute :asset-path "/js/compiled/out"
(see https://github.com/clojure/clojurescript/wiki/Compiler-Options#asset-path)
what could be the cause of errors like this:
Uncaught Error: goog.require could not find: reagent.dom.server
somehow I managed to mess up a perfectly working clojurescript project (created with Chestnut)
and even going back in the git history to something that was working fine, and cleaning up all the compiled files doesn't work
quite big actually @plexus
now the error changed to
interop.cljs?rel=1489229876903:19Uncaught TypeError: Cannot read property 'call' of undefined
at re_frame$interop$ratom (interop.cljs?rel=1489229876903:19)
at db.cljc?rel=1489229877862:10
re_frame$interop$ratom @ interop.cljs?rel=1489229876903:19
(anonymous) @ db.cljc?rel=1489229877862:10
hints.cljs?rel=1489229896763:57 GET 404 (Not Found)
devtools$hints$ajax_reader @ hints.cljs?rel=1489229896763:57
devtools$hints$retrieve_javascript_source @ hints.cljs?rel=1489229896763:62
devtools$hints$mark_null_call_site_location @ hints.cljs?rel=1489229896763:83
devtools$hints$make_sense_of_the_error @ hints.cljs?rel=1489229896763:92
devtools$hints$error_object_sense @ hints.cljs?rel=1489229896763:101
devtools$hints$global_error_handler @ hints.cljs?rel=1489229896763:118
data.cljs?rel=1489229877209:4Uncaught TypeError: Cannot read property 'call' of undefined
at data.cljs?rel=1489229877209:4
(anonymous) @ data.cljs?rel=1489229877209:4
hints.cljs?rel=1489229896763:57 GET 404 (Not Found)
devtools$hints$ajax_reader @ hints.cljs?rel=1489229896763:57
devtools$hints$retrieve_javascript_source @ hints.cljs?rel=1489229896763:62
devtools$hints$mark_null_call_site_location @ hints.cljs?rel=1489229896763:83
devtools$hints$make_sense_of_the_error @ hints.cljs?rel=1489229896763:92
devtools$hints$error_object_sense @ hints.cljs?rel=1489229896763:101
devtools$hints$global_error_handler @ hints.cljs?rel=1489229896763:118
ui.cljs?rel=1489229877478:44Uncaught TypeError: Cannot read property 'call' of undefined
at ui.cljs?rel=1489229877478:44
(anonymous) @ ui.cljs?rel=1489229877478:44
core.cljs:281Uncaught Error: No protocol method IDeref.-deref defined for type undefined:
at Object.cljs$core$missing_protocol [as missing_protocol] (core.cljs:281)
at Object.cljs$core$_deref [as _deref] (core.cljs:582)
at cljs$core$deref (core.cljs:1360)
at re_frame$cofx$db_coeffects_handler (cofx.cljc?rel=1489229878211:62)
at core.cljs:4903
at Function.cljs.core.update.cljs$core$IFn$_invoke$arity$3 (core.cljs:4903)
at cljs$core$update (core.cljs:4897)
at re_frame$cofx$coeffects_before (cofx.cljc?rel=1489229878211:44)
at re_frame$interceptor$invoke_interceptor_fn (interceptor.cljc?rel=1489229877779:67)
at re_frame$interceptor$invoke_interceptors (interceptor.cljc?rel=1489229877779:102)
at re_frame$interceptor$execute (interceptor.cljc?rel=1489229877779:145)
at re_frame$events$handle (events.cljc?rel=1489229877950:63)
at re_frame$router$dispatch_sync (router.cljc?rel=1489229878113:254)
at Object.scrabble$core$init [as init] (core.cljs?rel=1489229882524:24)
at (index):11
an undefined coming out of somewere
That looks like it's coming from the code that calls React. Is js/React defined? (just guessing really)
that's the project.clj https://github.com/AndreaCrotti/scrabble/blob/master/project.clj
I wonder if it's related to the paths since trying to load any file fail in cider
@andrea.crotti The problem is conflicting React versions and React-dom versions from Devcards and Reagent
argh ok @juhoteperi
how do you normally find out about these issues?
and I wonder it only happened today
maybe because I did some clean builds
(Or it is at least quite possible that is the problem, React 15.4 changes the packaging)
Reagent 0.6.1 was released yesterday
I was also messing around with the :uberjar configuration to get it deployed to Heroku correctly, but that should not affect running locally right?
tried to remove devcards and downgrade reagent to 0.6.0 to see what happens
so now I get this
dom.cljs?rel=1489229876728:19Uncaught Error: js/ReactDOM is missing
at reagent$dom$module (dom.cljs?rel=1489229876728:19)
at reagent$dom$render_comp (dom.cljs?rel=1489229876728:30)
at Function.reagent.dom.render.cljs$core$IFn$_invoke$arity$3 (dom.cljs?rel=1489229876728:54)
at reagent$dom$render (dom.cljs?rel=1489229876728:41)
at Function.reagent.dom.render.cljs$core$IFn$_invoke$arity$2 (dom.cljs?rel=1489229876728:49)
at reagent$dom$render (dom.cljs?rel=1489229876728:41)
at Function.reagent.core.render.cljs$core$IFn$_invoke$arity$2 (core.cljs?rel=1489229876864:72)
at reagent$core$render (core.cljs?rel=1489229876864:63)
at re_frisk$core$render_re_frisk (core.cljs?rel=1489229880044:22)
so re-frisk also didn't like some change of libraries
back to this error now after disabling re-frisk
goog.require could not find: reagent.dom.server
goog.logToConsole_ @ base.js:639
goog.require @ base.js:679
(anonymous) @ core.cljs?rel=1489235117837:1
base.js:681Uncaught Error: goog.require could not find: reagent.dom.server
at Object.goog.require (base.js:681)
at core.cljs?rel=1489235117837:1
Could still be something with mismatched React versions, I tried React 15.3.1 and React-dom 15.4 on got several errors
mm now the versions are these for react
[reagent "0.6.0"]
[cljsjs/react-dom-server "15.2.1-0"]
[cljsjs/react-dom "15.2.1-0"]
[cljsjs/react "15.2.1-0"]
so that should be fine
but it's not apparently 😄
if I do however lein cljsbuild dev
I get
Caused by: clojure.lang.ExceptionInfo: No such namespace: scrabble.core-test, could not locate scrabble/core_test.cljs, scrabble/core_test.cljc, or Closure namespace "scrabble.core-test" in file src/cljs/scrabble/runner.cljs
which is something I don't see at all with figwheel in cider for some reason
but it's probably the root cause of the problem
do you have a file at scrabble/core_test.cljs
? note the underscore
generally in the source paths of cljsbuild I should include also the cljc directories right? :source-paths ["src/cljs" "src/cljc"]?
actually I don't, only have scrabble/core_test.clj
then you can’t require that namespace in runner.cljs
that was just for the test profile in cljsbuild and didn't cause issues before though
now it compiled app.js correctly let's see if it works
alright different error
Uncaught Error: js/ReactDOM is missing
at reagent$dom$module (dom.cljs?rel=1489235117536:19)
at reagent$dom$render_comp (dom.cljs?rel=1489235117536:30)
at Function.reagent.dom.render.cljs$core$IFn$_invoke$arity$3 (dom.cljs?rel=1489235117536:54)
at reagent$dom$render (dom.cljs?rel=1489235117536:41)
at Function.reagent.dom.render.cljs$core$IFn$_invoke$arity$2 (dom.cljs?rel=1489235117536:49)
at reagent$dom$render (dom.cljs?rel=1489235117536:41)
at Function.reagent.core.render.cljs$core$IFn$_invoke$arity$2 (core.cljs?rel=1489235117837:73)
at reagent$core$render (core.cljs?rel=1489235117837:64)
at scrabble$core$mount_root (core.cljs?rel=1489235251788:20)
at Object.scrabble$core$init [as init] (core.cljs?rel=1489235251788:26)
at (index):11
wait a minute it loaded correctly now
back to life 😄
If you want to upgrade to latest Reagent, and cljsjs/react
dependency from Devcards causes problems, you can just add direct dependency to your project to fix this
I'm not using devcards anyway for now
I removed it
... now I wonder if there is any reason for having separate packages for react/-dom/-dom-server, the versions probably have to match always so it might make sense to provide those in one package
it looks like however that it never does a clean build using cider/figwheel and maybe you have problems and not even notice
ah well maybe because you might need only one of those things?
Cljs will only include JS files that are required by namespaces in application, so if nothing requires e.g. cljsjs.react-dom-server
, the JS file is not included in output
ah well, btw for this debugging madness restarting the whole thing with Cider with jack-in-clojurescript takes forever
any faster way?
maybe running figwheel from the console would be faster in this case?
Re: clean builds, you need to call lein clean
to get a clean build, AND if your output-dir is outside of target/
you also need to setup :clean-targets
now I also have to finally get it all running in Heroku, does anyone have a working :uberjar configuration?
I was trying with something like this
:uberjar {:hooks [leiningen.cljsbuild]
:env {:production true}
:omit-source true
:aot :all
:main scrabble.api
:cljsbuild {:source-paths ["src/cljs"]}}
but one thing I'm not sure is why repeating again all the cljsbuild configsince it's already also set below
or it's normal to repeat it?
and thanks for the help btw @juhoteperi
the other thing I don't quite get is that some dependencies (for example re-frisk) where only declared in the dev configuration
core.cljs was using them only in dev-setup but still requiring the package on top
should I make these requires optional then or how is it normally done?
Is there a way to access the “default export” of a JS module written in the commonjs when using foreign libs? The library I’m using defines a default export which is a class I need to instantiate. Assuming I require the module like:
(require [js-lib :as SomeClass])
I can access (SomeClass.staticMethod)
but I can’t create an instance of the class like (SomeClass.)
@tstephens support for that just landed yesterday in the ClojureScript compiler https://github.com/clojure/clojurescript/commit/1d38f73a86081ad54cb230c507fbae183d768d6b
you'll need to wait for the next version
probably?
I don't know if that will work
ok, i’ll give it a shot; i guess it depends on how the JS module was implemented, but their docs indicate it should work, anyway
@tstephens js/SomeClass.
would assume that there is a global js/SomeClass
but there isn't
well, the module is already compiled, and their docs say they’ve added SomeClass
to the window
should I not be using foreign libs at all in that case? the documentation is a little unclear about that
How can I access Chartist.Line dynamically, where the Line is provided as a string. I thought to try (aget Chartist "Line")
but apparently Chartist isn't an object itself.
Also goog.object/get
aget
is only meant to be used on arrays
Getting some unexpected behaviour using aget vs goog.object/get, I think it's around incorrect wrapping with new.
(new (goog.object/get js/Chartist type) node data)
→ return (new goog.object.get(Chartist,type)(node,data));
<-- this throws. It should probably be (new (goog.object.get(…))(…))
(new (aget js/Chartist type) node data)
→ return (new (Chartist[type])(node,data));
My work around is to do:
(let [x (goog.object/get js/Chartist type)]
(new x node data))
I'm not sure if/how to report this? Is this expected?aget
works for you because it is a macro which expands to something which includes outer parens before the new
special-form gets its hands on it
Anything else beside http://thi.ng and gamma to do OpenGL/WebGL in cljs? http://Thi.ng looks ok but it's been idle for a while and gamma seems a bit too alpha (very interesting concept too)...