Fork me on GitHub
#clojurescript
<
2017-07-08
>
souenzzo00:07:56

@anmonteiro (let [x (js-obj)] (aset x "foo/bar" 33) x) Why this works on lumo, but throws exception on figwheel+chrome

souenzzo00:07:12

(both 1.9.671)

dnolen00:07:03

@wilkerlucio not just for that. Could get folded into next release if patch provided

dnolen00:07:36

But release will come in 2 weejs

mfikes00:07:45

@souenzzo's issue has to do with *print-namespace-maps* for some reason

souenzzo00:07:10

mfikes: on both repl's, it has false value

mfikes00:07:24

Try (set! *print-namespace-maps* true) and then *print-namespace-maps* to see if it "takes". There might be an odd nREPL issue setting this dynamic Var.

souenzzo01:07:27

cursive repl somehow always overwrite this var... on rlwrap lein figwhell it works.... I will debug. Thanks ;D

mfikes01:07:53

Patch applied to the ticket if you need to temporarily get around this some other way. See http://blog.fikesfarm.com/posts/2016-02-22-trying-clojurescript-paches.html

souenzzo01:07:44

mfikes: I submitted a patch.

wilkerlucio00:07:16

@dnolen I saw there is a patch there, but not sure if that already fix the issue

anmonteiro00:07:50

The patch is not correct

anmonteiro00:07:01

Was an attempt to play around with the issue

dnolen01:07:16

We have constant replacement now, should use that

wilkerlucio01:07:31

gotcha, thanks for the clarifications

qqq02:07:06

I have an image-url . It loads fine when I add a new element: [:img {:src image-url}] However, instead of adding the image to the page, I want to get the data of the image as a Float32Array. What is the best way to approach this ?

qqq04:07:24

when using reagent/react, is there a way to update an image without base64 encoding the data ?

myguidingstar09:07:02

@thheller how do I disable devtools in a "watch" build targeting node-library? I'm not allowed to install "ws" package to my project

thheller09:07:13

@myguidingstar :devtools {:enabled false} in your build config

myguidingstar09:07:06

thanks. I tried {:autoload false} instead 🙂

thheller09:07:59

how come you are not allowed to install ws? it is just a dev time dependency?

myguidingstar09:07:01

actually it's not nodejs but a similar engine and no native dependencies is allowed

myguidingstar09:07:27

btw, how do I specify dev/cljs-runtime directory to somewhere else? @thheller

thheller09:07:15

@myguidingstar :output-dir "some/path" in the build

thheller09:07:20

interesting, I thought about reworking the node stuff to be a little more generic and not just for node

myguidingstar10:07:56

@thheller will shadow-cljs support different :dependencies and :src for different builds?

thheller10:07:11

why should it?

myguidingstar10:07:26

my node module breaks because of some browser-specific deps I set for another build targeting browser

thheller10:07:49

hmm? unless you specifically :require those deps they won’t be in the build

myguidingstar10:07:47

that's strange. I keep seeing "XMLHttpRequest is not defined"

thheller10:07:29

do you know which namespace triggers that?

thheller10:07:47

should be in the stacktrace

myguidingstar10:07:05

hmm, I removed the deps but they still remain. How do I clean build cache?

thheller10:07:21

oh wait are you using :npm-module as the build :target?

thheller10:07:22

ok, then shadow-cljs will follow all your :exports and only include namespaces that where required somewhere

thheller10:07:43

cache should not be a problem

myguidingstar10:07:43

right. I'll find the problem somewhere else...

myguidingstar12:07:45

@thheller what about cljsjs deps that tell compiler to preamble some js files?

myguidingstar12:07:28

I think that causes unwanted js names in my node module's output

thheller12:07:10

@myguidingstar which cljsjs package? I can take a look

thheller12:07:43

but the same applies here. it will only be included if you :require it

myguidingstar13:07:17

never mind. I understand how cljsjs works now

assoc-in17:07:47

Does anyone get "Namespace xxxx does not exist" when they compile or load a file that requires the namespace xxx with cider in emacs? The file does exist and the compiler outputs a fully working build with no errors. The stacktrace drills down to a call to cljs.closure$source_for_namespace.invokeStatic(closure.clj:707) so it looks like the compiler from emacs isn't aware that the source code for the file does? Any ideas?

grav17:07:11

@qqq It seems you have to use base64 for binary data, according to https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Another option might be to use a <canvas> tag

dnolen19:07:17

@assoc-in doesn’t seem like an Emacs or Cider thing - your project must follow Java classpath conventions

dnolen19:07:21

that’s how we resolve namespaces

assoc-in19:07:37

@dnolen It turned out to be something odd with running cider-jack-in-clojurescript on my setup. I was able to debug it with the help of @yogthos in the #luminus channel. I am using the following and I don't have Namespace not found errors anymore. Thanks for the reply! 0. Cider-jack-in 1. run (start) in clj repl 2. run lein figwheel in terminal 3. run cider-connect "localhost:7002" 4. in this new repl run (cljs) 5. in that new repl run (M-x eval-expression "(setq cider-repl-type "cljs")") 6. Cider commands such as C-c M-n and C-c C-k work now!

ajs19:07:33

@assoc-in wow that's a weird one. I've run into issues like that before with cider, one of the reasons I switched to the Emacs inf-clojure

assoc-in19:07:11

Interesting I'll have to check it out

jsselman20:07:35

@assoc-in I was facing that exact issue last night and it was driving me crazy! I'll try the steps you listed

jsselman20:07:11

probably the same as https://github.com/clojure-emacs/cider/issues/2028, although my directory path was just src and test

assoc-in21:07:55

@jsselman Looks quite similar to what I was facing. I am thinking that it could be a bug in figwheel-sidecar, since that step is skipped by running figwheel from the terminal and then connecting to it via cider. Also I lost tab complete by doing my workaround.

lxsameer22:07:58

how can i use closure compiler dead code elimination at its maximum with clojurescript ? what's the best practices to require my namespaces

darwin23:07:35

@lxsameer I’m afraid your question is too general and unlikely to get good response. ClojureScript does good job out of the box but there still can be specific (corner) cases where DCE is prevented unexpectedly. To my knowledge it is not really dependent on how you structure your namespaces. It is more dependent on what code constructs do you use and what is the shape of resulting javascript.

darwin23:07:38

I would recommend you to compile your project in :advanced mode with source-maps enabled, and use a tool like https://github.com/danvk/source-map-explorer to explore results.

darwin23:07:15

When you get to a point where you see some dead code you can experiment with different code to identify the problem. But it is a daunting work. For example here I went through similar workflow and identified a few cases where DCE was prevented: https://github.com/binaryage/cljs-devtools/issues/37

lxsameer23:07:35

thanks, In general i was wondering whether to prefer referring to a function or requiring the whole namespace as a symbol and user something like symbol/fn to address a function.

darwin23:07:19

not sure what you exactly mean by “requiring the whole namespace as a symbol”, but in general you should be writing dumb code, something which will map nicely for google closure compiler to understand it fully

sundarj23:07:53

he means doing :as instead of :refer

sundarj23:07:20

but that doesnt make a difference to the compiled file as far as im aware

sundarj23:07:24

and :as is preferred anyway right, so you dont pollute the namespace with external functions

lxsameer23:07:42

thanks guys