Fork me on GitHub
#clojurescript
<
2017-02-25
>
piotr-yuxuan00:02:31

Indeed it works with the previous one [org.clojure/clojurescript “1.9.473”]. Just for my own curiosity, would you have any idea why that bug happens?

dnolen00:02:31

yes a commit we need to backout

dnolen00:02:16

actually cutting a release now

piotr-yuxuan00:02:39

@darwin you’re right but I haven’t tried because I think it’s been some time maven/leiningen don’t support anymore “LATEST” pseudo-version (I should have tried though)

dnolen00:02:59

just pushed 1.9.494

piotr-yuxuan00:02:21

Indeed it works fine now 🙂

piotr-yuxuan00:02:14

I’ve got a very newbie question about Closure library: I’ve got the very latest versions (less than 5 minutes ago) on the same aforementioned project (even more up to date than https://clojurians.slack.com/files/piotr2b/F49K0JNL8/Untitled.clj) but it looks like some parts of Closure library aren’t available. For example, in the console goog is defined and so is goog.math but not goog.math.Rect. Am I missing something?

anmonteiro00:02:44

@piotr2b did you (import '[goog.math Rect])?

piotr-yuxuan00:02:08

That’s it \o/ thanks!

emccue03:02:02

Is there any Google closure magic for joining "http://apipath.com:2020" and "/path/etc"

emccue03:02:43

goog.path.join has some notably strange behaviour

peeja04:02:11

What's the state of the art in using npm modules from ClojureScript? Should I still be maintaining a package.json and using cljs.nodejs/require, or is there something closer to cljsjs for node?

deas05:02:08

Seems current closure compiler has an issue with nested node module name generation. 😢

anmonteiro06:02:14

@deas is there evidence of that?

anmonteiro06:02:47

i.e. a github issue or a minimal example?

deas07:02:00

@anmonteiro Will sort things out and get back. Don't have the code with me, so it might not happen before Monday. Just wanted to check if you been there already. 😉

rmuslimov08:02:32

I’m reading this pretty new tutorial https://clojurescript.org/guides/javascript-modules and I’ve got working import feature today. However, I keep struggling with two issues so far: 1. Is there anyway to get more information about syntax mistake if js-files have any of it? Now, I getting huge trace from nashorn and it’s hard to understand which particular place caused an error. 2. I tried to use node dependencies like import React from ‘react’, unfortunally it doesn’t work. But if I’m change it to var React = require(‘react’) it seems like it works. Anything I’m doing wrong or missing?

leroix18:02:54

anyone have experience with boot-reload and boot-cljs-repl?

leroix18:02:36

I’m noticing that they add about 100 files that have to be loaded when the page loads

leroix18:02:07

I know we could turn on :optimizations :whitespace, but that slows my recompiles down

leroix18:02:13

thinking about switching back to figwheel

andrea.crotti19:02:23

If I want to do some interactive graphs with Clojurescript what's the best thing to use?

andrea.crotti19:02:39

Wrapper to d3, or anything else?

andrea.crotti19:02:02

Would like to use reframe in that same project

andrea.crotti19:02:09

Quill might also be nice even if not really the same thing

mikebelanger21:02:06

@leroix iirc those 100 files might just be for source-maps. Try loading the un-optimized one with only whatever file the boot-cljs prompt says when you make a file-save.

leroix21:02:37

hmm, I’m looking specifically at .js files in the network tab

metametadata21:02:44

@pupeno it's a precondition, a part of defn

mikebelanger21:02:46

@leroix yeah there's a lot of files, sure but which file does the boot prompt tell you just after you save a file?

mikebelanger21:02:18

@leroix looking in whatever terminal emulator you launch boot from, I mean

metametadata21:02:54

I needed to make sure that on-change prop is passed, otherwise the wrapper doesn't work

leroix21:02:00

@mikebelanger not sure what you mean. just after a save I generally see

Compiling ClojureScript...
• js/dev.js
This is the file we load, but it in turn loads its many other dependencies

mikebelanger21:02:57

@leroix right it loads transitive dependencies, when you compile to :advanced it should all be in the one file.

leroix21:02:27

yea, definitely. we do that for production, but my main concern right now is local development

mikebelanger21:02:29

@leroix .....oh sorry I re-read your question, you're asking if you can compile un-optimized and in one file at the same time 😛

leroix21:02:30

yea having just boot depedencies load a 100 different js files hurts page load times in local dev

mikebelanger21:02:57

@leroix I guess I've never seen that as an issue. How much could it possibly slow down page load times if they're all local anyways?

juhoteperi21:02:59

This has nothing to do with Boot(-cljs), this is how ClojureScript works when using :optimizations :none

leroix21:02:49

@juhoteperi you’re right, but I’m just saying that I’ve noticed a large portion of my 400 js files that have to load are from boot(-cljs)(-reload)(-cljs-repl)

leroix21:02:09

browsers restrict the number of files that can be loaded at once from a single domain

leroix21:02:17

so it’s local but it still takes a while

leroix21:02:29

3-4s to load the js and then another 3-4s to evaluate

leroix21:02:32

before the page finally loads

leroix21:02:46

we’re looking into tuning our project, but I was curious about boot specifically

leroix21:02:52

well not boot itself

juhoteperi21:02:54

Hmm, I don't think Boot cljs should load that many files, it should be something like 4 JS files from Boot-reload and maybe 1 or 2 from Cljs-repl

leroix21:02:58

but boot-reload boot-cljs-repl etc.

juhoteperi21:02:31

The Cljs files from the tasks will depend on some Closure libraries and ClojureScript namespaces, but most of those would be loaded anyway

leroix21:02:43

just noticed that if I remove boot-reload and boot-cljs-repl, the number of js files decreases by 100

juhoteperi21:02:41

It might have something to do the tricks Boot-reload does with Closure module loading, in order to support hot reloads

leroix21:02:38

yea, I think it depends on a lot of cross domain messaging dependencies in in the closure library

juhoteperi21:02:41

By the way, do you have "Disable cache" enabled in Chrome devtools?

leroix21:02:06

figwheel doesn’t seems to have the same footprint

juhoteperi21:02:35

Yeah, that will make it much slower, most of files from Cljs and Closure won't change so disabling "Disable cache" should help, but I'm not sure if that causes some problms

juhoteperi21:02:06

Figwheel is using a bit different code to enable hot reloading, it could cause some differences

mikebelanger21:02:12

@leroix I've noticed a bit of a speedup when I ask boot-reload to load a specific symbol. But obviously that would only work if you're focusing on one area of code at a time

juhoteperi21:02:47

@leroix Do you have .cljs.edn file?

Pablo Fernandez21:02:42

Cool. I wasn't aware of those.

leroix21:02:55

@mikebelanger that’s interesting. I haven’t tried that. generally we hit the same top level function.

juhoteperi21:02:50

Btw. disabling recompile-dependents will break hot reloading e.g. when you change def in one file and that var is used in a other file

leroix21:02:29

gotcha, yea I think we were having trouble with long recompile times with it turned on

juhoteperi21:02:13

Yeah, changing a file in which all other namespaces depend (transitively) can cause really slow recompilations in large projects

juhoteperi21:02:55

Worst I have had was something like 2 minutes if a common utils file was changed

leroix21:02:39

that would kill me 😞

mikebelanger21:02:00

@leroix that said I don't know if you can reload a top-level function definition. Whenever I've tried using (reload :on-jsload 'the-fn.. it asks for arguments. There might be a way of reloading a function but I've never figured that out. I've only any kind of symbol

juhoteperi21:02:08

Luckily such files don't need to be changed often, if the project is well structured. And I still prefer using recompile-dependents as it can prevent really strange problems.

leroix21:02:11

if you do hit those issues, I imagine you just have to make a change in the affected dependent file to start another recompile?

juhoteperi21:02:45

Yeah, but it is easy to forget that 🙂

leroix21:02:49

@mikebelanger ah yea, that’s what I meant. we use a symbol as well

leroix21:02:10

and the function itself just calls (reagent/force-update-all)

juhoteperi21:02:14

Okay, I can reproduce 180 loaded files with with Boot-reload vs. 90 files without

leroix21:02:15

which I’ve heard can be an issue some times

juhoteperi21:02:08

I wonder if Boot-reload will load all the JS files in output dir, even if they are not needed...

leroix21:02:04

good question. I think the compiler would only output what’s explicitly required right?

juhoteperi21:02:50

True. Using boot-reload will double the number of files in output-dir

juhoteperi21:02:23

I think the files are mostly from Closure modules used by Boot-reload client

leroix21:02:48

yea, that sounds right to me

leroix21:02:30

goog.net.jsloader and goog.net.WebSocket are pretty heavy I think

juhoteperi21:02:36

In larger projects the difference will be smaller as some of those Closure modules will be used by the app anyway... But it might still be good idea to change Boot-reload to depend on fewer Closure modules.

leroix21:02:44

yea, I’d say our project is pretty large 13k lines of cljs and 133 namespaces

leroix21:02:06

and before and after boot-reload there’s still about 90 js files difference

leroix21:02:49

It sounds like the plan may be to make boot-reload work with the figwheel client eventually

leroix21:02:13

reading through some of the issues on the boot-reload repo

leroix21:02:31

good stuff

leroix21:02:42

hadn’t seen that before