Clojurians
#cljs-dev
<
2018-06-05
>

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

anmonteiro03:06:41

@richiardiandrea that already works… you can npm install based on your package.json dependencies and just require them in your ClojureScript namespaces. That’s the whole reason why we index node_modules before compiling

richiardiandrea04:06:31

Oh cool @anmonteiro thanks, I should have added while compiling: does it work the same for compilation?

anmonteiro05:06:35

what are you asking? I don’t understand exactly

richiardiandrea05:06:45

To reword it a bit, if I drop :npm-deps during compilation would the compiler still take node_modules deps? I remember having seen two different code paths but I might also be very wrong

anmonteiro06:06:52

yes, the way I understood it that’s what you asked initially

juhoteperi17:06:09

Closure got finally fix for UMD wrapper detection, this should fix React 16 UMD bundles: https://github.com/google/closure-compiler/pull/2963

dnolen18:06:24

well then I think we should probably wonder if this has got anything to do with ClojureScript

symfrog18:06:00

doing nothing on the ClojureScript side would mean that all foreign libs would need to be packaged with "use strict" global directives stripped out to be usable with :modules, would this be the option you would suggest?

dnolen19:06:38

I’m not yet convinced about your hypothesis

dnolen19:06:53

“use strict” should be file local as far as I know

dnolen19:06:08

I do not believe that React would enforce this on all scripts

dnolen19:06:14

and I do not believe that minimized React would not strip it

symfrog20:06:02

@dnolen The minified and optimized React v16 js specifies a global "use strict" directive, it can be seen on the first line here: https://unpkg.com/[email protected]/umd/react.production.min.js (https://reactjs.org/docs/cdn-links.html) . cljsjs/react uses the same https://github.com/cljsjs/packages/blob/master/react/build.boot#L22 .

symfrog20:06:37

React v16 is not needed to repro the issue, setting a global "use strict" directive on any module output where another module will attempt to load and invoke a function will repro the issue.

dnolen21:06:18

@symfrog did previous minified versions of React have that?

symfrog21:06:16

@dnolen no, there was no global directive in v15, the global directive was introduced in 16.0.0

dnolen22:06:15

this seems broken to me, how is this not considered a bug if people are going to concatenate?

lee.justin.m23:06:16

fwiw, bundlers like webpack and browserify wrap each script in an IIFE and use function-local “use strict”. it appears that the ‘use strict’ problem is part of the reason why: https://github.com/browserify/browserify/issues/926