Clojurians
#cljs-dev
<
2017-03-22
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

mitchelkuijpers09:03:49

I thinks it is a google closure problem, just tried the following:

java -jar ~/bin/closure-compiler-v20170218.jar --module_resolution NODE --js src/libs/npm_stuff.js --js_output_file test.js --process_common_js_modules true
src/libs/npm_stuff.js:1: WARNING - Failed to load module "styled-components"
var Styled = require('styled-components');
    ^

src/libs/npm_stuff.js:1: WARNING - Failed to load module "styled-components"
var Styled = require('styled-components');
             ^

0 error(s), 2 warning(s)

mitchelkuijpers11:03:43

This is a different error because it does not traverse node_modules ofcourse.. :sweat_smile:

spinningtopsofdoom13:03:00

@mitchelkuijpers I'm giving a talk on ClojureWest about compiling node modules specifically going through the low level details of how it works.. Do you mind if I use the bug you've found as an example of why this is useful?

martinklepsch13:03:11

@spinningtopsofdoom that sounds like it’s gonna be an interesting talk :+1:

spinningtopsofdoom13:03:25

Hopefully BTW I'm including you in my thanks for you post on Parameterizing ClojureScript Builds

martinklepsch14:03:03

:blush: — were you giving a talk at bobconf in january btw?

martinklepsch14:03:47

@spinningtopsofdoom FWIW I recently tried using some module stuff too but ran into an issue with things being used before they got defined: https://github.com/martinklepsch/weekly-log has a repro and instructions. Did you stumble into anything like that during the research for your talk?

spinningtopsofdoom14:03:18

I haven't run into that yet. I can take a look when I get off of work. I've gotten my presentation in it's final format so I have time to look into all the fun edge cases with compiling node modules

martinklepsch14:03:42

Someone sent me a pic from that talk because you mentioned my porting of collection check to CLJS there… :slightly_smiling_face: Seeing it I pinged @ztellman again and it got merged… finally :smile:

spinningtopsofdoom14:03:49

That's great now I don't have to have the extra hoop of locally installing your port of collection check :+1:

mitchelkuijpers14:03:08

@spinningtopsofdoom No problem at all

martinklepsch15:03:35

I guess it would make sense to run through Closure without CLJS and see if the issue is still there but didn’t quite know how to do that until I saw Mitchel’s snippet above…

anmonteiro15:03:08

@mitchelkuijpers ofc that's not gonna work

anmonteiro15:03:21

You need to include the entire paths

anmonteiro15:03:34

@martinklepsch did you try running that with Closure from master?

mitchelkuijpers15:03:48

@anmonteiro Yeah i found that out, this was the first time playing with the google closure compiler

martinklepsch15:03:32

@anmonteiro yes tried with Chad’s branch

anmonteiro15:03:01

@mitchelkuijpers the interestig thing is that it works if you require supports-color directly

martinklepsch15:03:03

Did not rebase it against master first I think though

anmonteiro15:03:12

So will need to look into that

anmonteiro15:03:31

@martinklepsch hrm might be better to try that first

mitchelkuijpers15:03:36

Oh really? maybe it has something todo with the umd wrapping stuff or something..

mitchelkuijpers15:03:05

But that is definitely interesting

anmonteiro15:03:21

Apply that patch on current master with git am < /path/to/patch and build again

anmonteiro15:03:12

If it still doesn't work make sure to ping me so I look into it on the weekend!

martinklepsch15:03:17

I cherry picked 9e9f1ab into current master and rebuilt Closure. Same issue :confused: @anmonteiro

anmonteiro15:03:16

OK I’ll look into it soon!

anmonteiro16:03:13

<rant> people excited by a 1 KB drop in React, but most don’t acknowledge what Closure can do for them https://twitter.com/kentcdodds/status/844542288877539328 </rant>

shaun-mahood16:03:58

This seems like the perfect reason for threading, since I'm not sure if I'm being sarcastic or serious. Is this legitimate excitement over 1kb improvement? Is there any possible way this can actually make a relevant difference to anything that actually should be using react?

anmonteiro16:03:37

well, read the rest of the thread and you’ll see they’re serious

anmonteiro16:03:07

has to parse less 20% JS

anmonteiro16:03:22

sure, but 20% of a small thing is even smaller, just like 20% of 0 is 0 :slightly_smiling_face:

mitchelkuijpers16:03:16

I think they are doing such weird things in the JS community. They create mini libs like left-pad and then they bundle it with a bundler which adds god knows how many bytes and now they are focussing on making this smaller again...

shaun-mahood16:03:00

There's an edit on the original comment (https://github.com/facebook/react/pull/9232#issuecomment-288398071), it's more like a 2% drop in real use. My guess is that it was the 20% that made them excited much more than the 1kb, which makes it seem a lot more of a rational thing to me - at least I hope that's the case at least!

mitchelkuijpers16:03:03

And then they say GCC is not really important because 99% of their community don't use it and now they seem to work on creating GCC

mitchelkuijpers16:03:03

:stuck_out_tongue:

spinningtopsofdoom16:03:40

Facebook is working on getting react ro compile with GCC for the new fiber build system

shaun-mahood16:03:10

I feel sorry for future new JS devs if they have to walk into a combination of GCC and all the JS build tools though...

thheller17:03:25

to be fair though .. at facebook scale the :advanced mode is not ideal

thheller17:03:02

but the 1kb drop is