Fork me on GitHub
#clojurescript
<
2017-09-01
>
Mikko Harju07:09:32

I’m trying to locally bump and test a CLJSJS package version. I updated the version number and MD5-checksum in build.boot and run

maharj:react-leaflet git:(master*) $ boot package install target
Downloading v1.6.5.zip
Extracting 133 files
Sifting output files...
Sifting output files...
Writing pom.xml and pom.properties...
Writing react-leaflet-1.6.5.jar...
Installing react-leaflet-1.6.5.jar...
Writing target dir(s)...
However, the package is not being installed to my local MVN repo (`~/.m2/repository`) and thus when I added the new version as a dependency to a project I get an error. What am I missing here? I’m completely new to boot since I’ve managed to use leiningen until now. Any ideas how to debug what is not working?

Mikko Harju07:09:55

Ah, nevermind. I was missing cljsjs/ from my prfefix in the dependency.

Mikko Harju07:09:01

I guess Leiningen adds the empty ~/.m2/repository/react-leaflet -directory when I declared it as a dependency. It misguided me.

sebastibe07:09:51

I have a lib available on js/react-google-maps and I would like to import an object which is in a nested folder places. In javascript that would be: import { SearchBox } from "react-google-maps/places"; but although I have access to the first level objects such as js/react-google-maps.GoogleMap, I can't access js/react-google-maps.places.SearchBox. Do you know what the interop method in that case?

sundarj08:09:39

i believe it's ["react-google-maps/places" :refer [SearchBox]]

sebastibe02:09:55

It doesn't find the namespace, I wonder if it might be due to the way I require Javascript library: through a Javascript file doing the require

sundarj17:09:13

the npm support is rather unfinished, you could try asking in #cljs-dev

danielstockton15:09:52

Can people throw out some names for some very lightweight cljs frameworks please?

bendlas15:09:53

frameworks for doing what?

bendlas15:09:24

the most general one I can think of is https://github.com/stuartsierra/component

sleepyfox15:09:03

Hi, quick Q: is it possible to compile some CLJS code into a CommonsJS module for use in a JS project?

sleepyfox15:09:47

I've spent the last hour searching Google and seen many articles talking about including JS modules in a CLJS project but nothing the other way round...

Roman Liutikov15:09:21

Do you want to pass compiled CLJS namespaces directly into something like Webpack?

Roman Liutikov15:09:05

Because ClojureScript compiler emits a lot of code you’d need an optimizing compiler with decent DCE to remove what is not needed, non of JS tools can do it well

dnolen16:09:29

@sleepyfox not directly, there’s a different build tool called shadow-cljs that can do that

dnolen16:09:14

we might support that in the future but it’s not really a priority

sleepyfox16:09:11

OK, thanks David, I'll take a look

dnolen16:09:49

@sleepyfox if you go down that path you still need to understand how Closure Compiler works as @roman01la suggested

dnolen16:09:28

if this for client side stuff, you will want advanced compilation and that means you need to understand externs

colindresj17:09:21

@dnolen is there any easy way to use the master version of clojure script in a project? I'd like to get the npm-deps fixes?

urbank18:09:20

How do I begin debugging a case where the app doesn't show up under :advanced optimizations, but there's no error in the console?

pesterhazy18:09:32

@urbank trying a different browser, and doing lein clean

urbank19:09:35

@pesterhazy Hm... same on chrome edge and firefox. Did notice that I'm getting

urbank19:09:36

ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: file:/C:/Users/urban/.m2/repository/cljsjs/react/15.3.1-0/react-15.3.1-0.jar!/cljsjs/react/common/react.ext.js at (unknown source) line (unknown line) : (unknown column)

dnolen19:09:32

if there’s an error during build then there will be nothing to see

dnolen19:09:39

that means nothing got built

urbank19:09:19

Oh... hm though the next line says successfully compiled and it outputs the file.

dnolen19:09:33

well that line is wrong 🙂

dnolen19:09:55

if Closure emits a hard error, game over

urbank19:09:20

Ok, good to have that cleared up, thanks 🙂

dnolen19:09:26

as to that specific error message, you are somehow passing React externs twice

urbank19:09:36

hm... yes. Perhpas I have to add :exclusions somewhere in the deps?

pesterhazy19:09:00

that's an ancient cljsjs/react version too

urbank19:09:28

Which is weird. Isn't it true that if dependencies share a dependency the one at the bottom of the deps will be used? Or is that figment of my imagination?

urbank19:09:56

No longer getting this error after adding enough :exclusions. Now I'm getting a ton of required "some.my_namespace" namespace never provided.

urbank19:09:58

ERROR - required "some.my_namespace" namespace never provided goog.require('some.my_namespace');

urbank19:09:12

all of them seems to have underscores... hmmm

urbank19:09:29

replacing - with _ in the folder names fixed that.

genekim20:09:23

Oooh… :parallel-build true from @mfikes recommendation is awesome! My builds went from 71 seconds to 53 seconds (2012 MacBook Pro w/16 GB memory). Thx @dnolen ! 🙂 http://blog.fikesfarm.com/posts/2015-11-14-try-clojurescript-parallel-compilation.html

dnolen20:09:54

@genekim yes for cold builds it’s nice

mfikes20:09:52

@genekim If you are curious, the most I've been able to gain is about a speedup of 7 🙂 Here is the repo which has some ridiculous namespaces in it https://github.com/mfikes/fifth-postulate

mfikes20:09:48

(To me, this means 8-core boxes are a sweet spot for this kind of work.)

genekim20:09:18

Ha! @mfikes — that’s so great! Looking at your system configuration is making me wonder whether I ordered the wrong system yesterday. 2017 MacBook Pro. 😞 Hahaha.

mfikes20:09:46

Oh, a 2017 MacBook Pro is actually faster than a 2012 Mac Pro, I'd bet 🙂

genekim20:09:50

(and your amazing build times… I did a double-take when I saw 20 seconds…)

mfikes20:09:41

@genekim Another thing worth trying is fixing the heap at something like -Xmx8g. (Give it a decent amount of RAM, but it also appears to be important that this is limited to a fixed amount. If you don't have such a setting, some builds can actually be slower as the JVM seems to allocate too much RAM, or in some way inefficiently manage things.)

mfikes20:09:31

If you are using lein, put something like this in your project.clj:

:jvm-opts ["-Xmx8g"]

genekim20:09:19

Wow, @mfikes… That’s so awesome! 31.451 seconds. THANK YOU! You made my week!!! (and I’ve had a pretty great week already!)

mfikes20:09:15

Cool! Presuming you are using the latest compiler as well. It has had something like a speedup of 2 over the past several months (depending on your codebase, of course).

johnj23:09:36

What's the reason cljs doesn't improves js types? ex: (+ "5" 5)

dnolen23:09:06

@lockdown- that stuff supported in JS - well defined behavior - in ClojureScript undefined behavior

dnolen23:09:58

we issue a warning, and we may do other things in the future - the main reason we don’t bother at the moment is for performance