This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-21
Channels
- # aleph (2)
- # beginners (22)
- # boot (7)
- # chestnut (8)
- # cider (4)
- # clara (3)
- # cljs-dev (3)
- # cljs-experience (19)
- # clojure (69)
- # clojure-italy (8)
- # clojure-nl (1)
- # clojure-spec (11)
- # clojure-uk (17)
- # clojurescript (77)
- # cursive (22)
- # datomic (14)
- # events (1)
- # fulcro (78)
- # hoplon (51)
- # jobs (3)
- # keechma (1)
- # lambdaisland (1)
- # lumo (30)
- # off-topic (42)
- # om (22)
- # onyx (5)
- # parinfer (4)
- # portkey (1)
- # re-frame (15)
- # reagent (2)
- # ring (4)
- # spacemacs (1)
- # specter (23)
- # testing (1)
- # unrepl (60)
- # yada (8)
@anmonteiro I'll try to figure out how to use it and get some results.
@jrychter npm install -g source-map-explorer
then just point it at your advanced compiled files
source-map-explorer my-bundle.js my-bundle.js.map
take a screenshot of both for me
(assuming you have :output-to "my-bundle.js" :source-map "my-bundle.js.map" :optimizations :advanced
in your CLJS compiler options)
I think my advanced compilation settings do not produce a map file. But that should be easy to add.
must be a pain to debug runtime errors in prod for you
Well that is actually a really nice tool. Thanks for introducing me to this. Working on the reports now.
Unfortunately, the results (at least the HTML visualization) seem suspect. I can't see some of the modules in there. Anyway, I'll DM the details.
Are there things to check when you have a macros.clj
name space (which contains macros) but you get a
WARNING: No such namespace: macros, could not locate macros.cljs, macros.cljc, or JavaScript source providing "macros" at line 1400 /home/ikuchan/fun/schema/src/cljx/schema/core.cljc
I was trying to move schema to cljc and got stuck while trying to remove the warnings
Hey, I'm trying upgrade to ClojureScript 1.9.908 from 1.9.660 and when doing advanced compilation with :infer-externs true
, I'm getting this NPE from Closure.
java.lang.Thread.run Thread.java: 748
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 617
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1142
java.util.concurrent.FutureTask.run FutureTask.java: 266
com.google.javascript.jscomp.CompilerExecutor$2.call CompilerExecutor.java: 101
com.google.javascript.jscomp.Compiler$3.call Compiler.java: 830
com.google.javascript.jscomp.Compiler$3.call Compiler.java: 834
com.google.javascript.jscomp.Compiler.performOptimizations Compiler.java: 2421
com.google.javascript.jscomp.PhaseOptimizer.process PhaseOptimizer.java: 231
com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process PhaseOptimizer.java: 305
com.google.javascript.jscomp.DefaultPassConfig$57$1.process DefaultPassConfig.java: 2154
com.google.javascript.jscomp.ProcessDefines.process ProcessDefines.java: 120
com.google.javascript.jscomp.ProcessDefines.overrideDefines ProcessDefines.java: 134
java.lang.NullPointerException:
clojure.lang.ExceptionInfo:
from: :boot-cljs
clojure.lang.ExceptionInfo:
line: 190
I’m running into the same issue. filed an issue here: https://github.com/google/closure-compiler/issues/2629
Hey there! X-posting from #testing I know how to write tests in clojure(script) however I am not so sure on what to test, especially on the frontend side of things. What are the typical things that one should test in a Clojurescript app? I have a cljs app which uses reagent which has unit tests in place for the API calls. What other things should I unit test for? What things should be tested end to end (Components? JS library integration?) Should components have unit tests? If so how do I go about them
@udit Only a partial answer to your question, but this is a good tool for unit testing components https://github.com/bhauman/devcards
Thanks @iku000888 Have gone through this and seems interesting to setup. However this answers the “How to test” part and not “What to test”
hello~ I was trying to use npm-deps when I encountered this error when compiling:
TypeError: Path must be a string. Received { './locale-data/complete': false, './locale-data/complete.js': false }
at assertPath (path.js:28:11)
at Object.join (path.js:1239:7)
at Deps.<anonymous> ([eval]:115:32)
at emitOne (events.js:115:13)
at Deps.emit (events.js:210:7)
at <my project>/node_modules/@cljs-oss/module-deps/index.js:338:18
at onresolve (<my project>/node_modules/@cljs-oss/module-deps/index.js:198:14)
at <my project>/node_modules/@cljs-oss/module-deps/index.js:192:17
at onpkg (<my project>/node_modules/@cljs-oss/module-deps/index.js:542:27)
at <my project>/node_modules/@cljs-oss/module-deps/index.js:539:44
Any idea how to find out which JS file it was processing when this happened?
Does this error mean someone passed an object to the js require()
?@iku000888 On line 82 you are unconditionally requiring [schema.macros :as macros]
(I think perhaps you want to delete that line… it wasn’t in the original implementation.)
Anyone have a general idea about the performance of read-string
?
if perf matters, there are good alternatives (eg. transit) that are meant to be fast
@akiroz sorry for your trouble, that's fixed in master
added explanations: a purely functional cljs app with the elm architecture https://github.com/amitayh/elm-cljs
Maybe a naive question, but it is possible to get this package with the usages of other packages inlined, as one standalone js file? https://github.com/d3/d3-force We are using d3 version 3.5, but I can get away with using a new function from 4, although we would like to keep imported code from 4 as little as possible. Since d3 version 4 splits everything in modules, this opens up maybe importing only a little bit.
@anmonteiro with current cljs master (1.9.916), I'm getting the following while trying to build an app that uses react-dnd:
WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "./raw" at /home/nathell/projects/toy/node_modules/asap/browser-asap.js line 4 : 4
I'm thinking that the npm-deps interop doesn't (yet?) support libraries doing relative requires, is that right?
@djanus Probably not. Asap uses browser field to replace files in browser use (https://github.com/kriskowal/asap/blob/master/package.json#L19), and current Closure release doesn't yes support this, but it will in the next version: https://github.com/google/closure-compiler/pull/2604
@juhoteperi Awesome, thanks! It's interesting, though, that it already mentions browser-asap.js
in the warning
@djanus IIRC Closure releases snapshot version nightly, so you could try adding [com.google.javascript/closure-compiler-unshaded "1.0-SNAPSHOT"]
dep to your project and see if that helps, not sure if Cljs already has the necessary changes for this
@juhoteperi that’s actually released in Closure
1.9.908 has browser field support
I’ll try out that package later
Hmh, okay, I didn't see it was included in the release as I was looking at the orginal commit, and the Closure versioning is confusing.
they cut a Maven release that has more commits than the other one
@djanus I do see a bug here, thanks for bringing this up
@anmonteiro thanks for looking at this. Anything I can do to help out?
@djanus maybe try a patch once I figure it out 🙂
looking into it
@djanus OK immediate problem fixed in https://dev.clojure.org/jira/browse/CLJS-2333
I suspect there’s a bug in the Closure Compiler now though
I’ll look into that in Closure soon. I just submitted a patch during the weekend that should make it easier to fix (https://github.com/google/closure-compiler/pull/2622)
@anmonteiro I've applied the patch, and it doesn't fix the problem for me. Here's my full build log:
nathell@serpent:/tmp/gridlock$ lein cljsbuild once
Compiling ClojureScript...
Compiling ["target/cljsbuild/public/js/app.js"] from ["src/cljs"]...
WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "./raw" at /tmp/gridlock/node_modules/asap/browser-asap.js line 4 : 4
WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "./raw" at /tmp/gridlock/node_modules/asap/browser-asap.js line 4 : 14
WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "asap" at /tmp/gridlock/node_modules/dnd-core/lib/HandlerRegistry.js line 19 : 4
WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "asap" at /tmp/gridlock/node_modules/dnd-core/lib/HandlerRegistry.js line 19 : 12
WARNING: Protocol IFn implements method -invoke with variadic signature (&) at line 61 target/cljsbuild/public/js/out/reagent/impl/util.cljs
Successfully compiled ["target/cljsbuild/public/js/app.js"] in 19.171 seconds.
The project is at https://github.com/nathell/gridlock if you'd like to try it out. Checkout the npm-deps
branch and do a lein cljsbuild once
@djanus the module load failures are expected
that’s the Closure Compiler bug I’m referring to
ah okay
Re my own question earlier today: https://bl.ocks.org/mbostock/bb09af4c39c79cffcde4
Javascript module interop question, what would be the way, with the new Cljs, to require BasicParser
in https://www.npmjs.com/package/posix-getopt ?
I am trying (require '"posix-getopt/BasicParser")
but it is complaining and I am guessing it is not the right way
'"foo"
is pretty weird = ' prevents evaluation, and strings already self-evaluate
Yeah, you should arguably be able to do (require ['clojure.set :as 'set])
if you wanted to as well. Things are just presuming a certain pattern right now.
wow, TIL - cljs is weird sometimes
@richiardiandrea (:require [posix-getop :as go])
then use go/BasicParser
BasicParser
is an export, not a module inside the package
oh right thanks
this works too, which is great: (require '[posix-getopt :refer [BasicParser]])
yeah, forgot about that one
Has anybody tried http://prepack.io on a larger cljs project? I've just tried it on hello world ... it is achieving optimal dead-code removal when logging a string and it even manages to shave off 3K from logging a vector.
@bendlas I tried it in Lumo
I have a branch where it was working at some point: https://github.com/anmonteiro/lumo/tree/prepack
@anmonteiro I guess binary size is not a primary concern for lumo, but did you measure any space savings by chance?
they have made definite progress, though. last time i checked, prepack couldn't even compile clojurescript
@bendlas right it was about startup time but it didn’t help much
if you see the commit in that branch I had to wrap some CLJS code in functions for Prepack to run on the codebase
I haven’t looked at it in a while though