Fork me on GitHub
#shadow-cljs
<
2019-12-02
>
Pavel Klavík00:12:58

how long do you think it might take to fix the naming issue?

thheller00:12:35

might take care of it tommorrow

thheller00:12:39

too tired to do it now

Pavel Klavík00:12:41

Cool, no rush, thx

Saikyun07:12:36

hey, just wanted to say yet again, that shadow-cljs is such an amazing tool 🙂 very happy to be using it daily.

❤️ 20
iku00088809:12:27

Hi I am trying to consume vis-network as a npm-package using the ns require form

(my.ns
  (:require [reagent.core :as r]
            ["vis-network" :as vis]
            [clojure.string :as str]))
I run into https://github.com/visjs/vis-network/blob/c47be95c57caaa69ce31a6fca70fbf77f51fcac6/lib/network/modules/ManipulationSystem.js#L1206 this error with a release build so I am now doing a :simple build. I also noticed the following warning with the release build, but not sure whether it is related
Resource: node_modules/vis-network/dist/vis-network.min.js:2
 constant module$node_modules$vis_network$dist$vis_network_min assigned a value more than once.
Original definition at externs.shadow.js:4
Appreciate tips & pointers 🙂

thheller09:12:16

@iku000888 not sure what you mean. the warning you get can be ignored. what about the if you posted? looks like its checking the arity of a function? maybe one you passed in? (fn [arg1 arg2] ..)?

iku00088809:12:06

Thanks for checking! Right, so in a non release build the function I pass in gets correctly invoked

iku00088809:12:55

And with a release build throws an error with the pointed error message in the same context

iku00088809:12:43

Happy to post a repro later

thheller09:12:56

sorry I can't help much without seeing any code

thheller09:12:14

just a random source location of some code I've never seen before doesn't help 😛

iku00088809:12:54

No worries. I will try posting the repro method

thheller09:12:07

FWIW :advanced compilation will often remove function args if you don't use them. eg (fn [arg1 arg2] (use-only arg1))

thheller09:12:54

it'll optimize that to (fn [a] ...) since JS doesn't care if the arg is declared (usually)

iku00088810:12:56

@thheller Happy to report that bumping from [thheller/shadow-cljs "2.8.69"] to [thheller/shadow-cljs "2.8.76"] fixed the issue 😂 😂

iku00088810:12:18

Ah wait.. Copied 'optimization :simple

iku00088810:12:23

:man-facepalming:

thheller10:12:58

yeah thats exactly the issue I said

thheller10:12:03

you are not using the callback argument

thheller10:12:31

so the closure compiler will remove it from the argument list to make to code smaller

thheller10:12:30

it looks like you are supposed to call the callback though?

thheller10:12:09

just do (callback) after you did the update?

iku00088810:12:39

Yup that fixed it 👍

iku00088810:12:46

I did not need call it because I discard the object upon re-rendering, but now I am enlightened

iku00088810:12:16

Thanks for the help @thheller 🙏

Pavel Klavík11:12:02

Thx, looking at it. I am currently building uberjar like this in project.clj:

["clean"
 ["run" "-m" "shadow.cljs.devtools.cli" "release" "client"]
 "compile"
 ["less" "once"]]
Any idea how to add the version there in the easiest way?

thheller11:12:40

I'd probably create something like the release fn described here https://shadow-cljs.github.io/docs/UsersGuide.html#clj-run

thheller11:12:03

and then just run -m my.build/release from lein

thheller11:12:39

(shadow/release :my-build {:config-merge [{:release-version "v1"}])

thheller11:12:59

note the extra vector that is currently required (since you are allowed to use --config-merge multiple times too)

romdoq14:12:45

I'm trying to upgrade the version of shadow-cljs that my :npm-module uses, but I'm finding that (from version 2.8.69) :closure-defines in shadow-cljs.edn isn't overriding the default values. Did something change in how that's configured? The documentation doesn't seem to differ from what I have. Though for my current purpose I should be able to use goog.DEBUG, since that appears to still get set.

Pavel Klavík14:12:48

@thheller thx for the quick, got it working with git commit ids; for anyone running on Heroku, this is very useful: https://devcenter.heroku.com/articles/dyno-metadata

romdoq15:12:18

Hmm, apparently the defines weren't the only thing preventing my devtools from working. I'm currently using (js/require "ardoq-sheet-load/build/npm/shadow.cljs.devtools.client.browser") to load the devtools while my module is embedded in our main app. This worked previously, but appears to no longer be enough/correct?

thheller15:12:54

@mel.collins if you are using project.clj or deps.edn then it is likely you just have a version conflict on the closure compiler/library releases

thheller15:12:21

should be

[com.google.javascript/closure-compiler-unshaded "v20191027"]

   [org.clojure/google-closure-library "0.0-20191016-6ae1f72f"]
   [org.clojure/google-closure-library-third-party "0.0-20191016-6ae1f72f"]

romdoq15:12:51

Hmm, I don't have any of those in my deps.edn right now

romdoq15:12:58

@thheller tried adding those versions explicitly, and it didn't change either of the issues I'm experiencing. 😞 For the defines issue, I can see in the browser console that $CLJS.CLOSURE_DEFINES contains myproject.core.EMBEDDED_DEV: true, but returning the value from a function within myproject.core returns false. 😕 To the devtools not working, I can see $CLJS.shadow.cljs.devtools.client.browser contains a bunch of functions and whatnot, so I guess it's being imported in some capacity, but none of the functionality is evident. Could the websocket be failing to connect silently? Not sure how to debug that. 😕

romdoq16:12:34

Hm. 2.8.68 is the most recent version where either of them work for me. Suggestions for fixing/debugging welcome, but otherwise I guess I'm going to have to stay on that release until I have more time/priority to investigate upgrading further. 😞

thheller16:12:05

@mel.collins which version did you try? 2.8.77 should definitely work everything before .76 may have had a problem

thheller16:12:48

.69 was the version that bumped the closure compiler/library so I'm fairly certain that is your issue

colinkahn17:12:01

Are there any settings I can change to prevent “Too many open files” errors?

thheller18:12:36

besides upgrading? haven't had any reports about that for a while now? which version are you on?

colinkahn18:12:03

@thheller that did it! 2.8.51 -> 2.8.77 fixed it

Pavel Klavík21:12:08

@thheller I was just testing :loader-mode :script and it works for WebWorker but source maps then don't work for the main code.

thheller21:12:19

hmm? I've been using workers all day and that worked fine?

thheller21:12:08

make sure you have :asset-path configured correctly though

Pavel Klavík22:12:31

:output-dir       "resources/public/js/compiled"
:asset-path       "/js/compiled"

thheller22:12:06

looks good. dunno why it wouldn't work then?

Pavel Klavík22:12:39

It does display the error in a readable form, but when I click at a cljs file, Chrome opens the corresponding js files (and it states in the top that source maps are available, but it does not use them for whatever reason)

Pavel Klavík22:12:04

and when I set :loader-mode to default, everything works fine

thheller22:12:21

dunno. that uses the same source maps.