This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-16
Channels
- # announcements (5)
- # aws (34)
- # beginners (145)
- # cider (48)
- # circleci (8)
- # clara (7)
- # clj-kondo (28)
- # cljs-dev (75)
- # cljsrn (4)
- # clojure (325)
- # clojure-czech (10)
- # clojure-europe (5)
- # clojure-italy (4)
- # clojure-nl (4)
- # clojure-spec (6)
- # clojure-sweden (3)
- # clojure-uk (70)
- # clojurescript (18)
- # clr (1)
- # community-development (2)
- # cursive (38)
- # data-science (7)
- # datascript (14)
- # datomic (22)
- # emacs (2)
- # figwheel (1)
- # fulcro (6)
- # graalvm (22)
- # graphql (11)
- # hoplon (12)
- # jackdaw (8)
- # jobs-discuss (16)
- # juxt (5)
- # leiningen (19)
- # luminus (5)
- # nrepl (2)
- # nyc (1)
- # off-topic (6)
- # overtone (2)
- # pedestal (10)
- # re-frame (6)
- # reagent (8)
- # reitit (1)
- # rewrite-clj (43)
- # ring (2)
- # shadow-cljs (124)
- # testing (1)
- # vim (22)
- # xtdb (77)
- # yada (4)
I’d like to detect if some JS code is compiled CLJS - can I do that to any degree of reliability? Is the imul
fix still prepended to all compiled CLJS?
@dnolen yes its important to be able to control how something resolves. In shadow-cljs this is done via :resolve
config which matches what webpack does. https://shadow-cljs.github.io/docs/UsersGuide.html#js-resolve
@lilactown thanks for the questions I left some answers
FWIW I created a simple example repo using code-splitting which I had difficulty with when trying to use webpack to do the splits https://github.com/thheller/code-splitting-challenge
If someone wants to work through webpack config a bit I'm sure there is an acceptable solution somewhere
I can't remember the details but the issues where either that webpack would include dependencies multiple times or create extra chunks with little info on how to load them or their dependencies
huh wow I've definitely been out of the Webpack loop - I guess they have Rollup style tree shaking now?
Also wasn't aware that Chrome now let's you see coverage - https://hackernoon.com/lessons-learned-code-splitting-with-webpack-and-react-f012a989113
webpack got tree shaking a while ago yes but its fairly limited in the type of packages it supports
some libraries instead came up with their own way to do this ... eg. https://github.com/ant-design/babel-plugin-import
but at least things are starting to get somewhat clearer now that multiple JS bundlers support this construct
I'm a bit concerned that everything is moving towards dynamic import()
but the closure compiler folks started work on adding support for that
React is pushing using dynamic imports a lot with React.lazy
. I would imagine once there’s prolific support for it that you might even see UI libraries leveraging it
yeah ... some lib on npm already started doing that for react. can't remember the name.
this is irrelevant to the discussion at hand, but I want to know how BuckleScript / PureScript / Elm et. al. handle mapping their lang’s namespaces to JS modules for tree shake-ability
I guess Elm has their own thing, but I know BuckleScript expects that you are bundling it yourself. they simply do a source -> source compile
afaik Elm is doing DCE before emitting JS
so folks are doing lazy imports and assuming Webpack will do sensible chunks so you don't just end up with a lot of network requests?
I just pushed a small change to master, goog.global
is now explicitly mapped to Node.js global
when compiling Node.js target. Useful when deploying hybrid Webpack / Node.js stuff
so if you bind it in cljs.core
some of the goog defines it does end up on the wrong object
I can't think of scenario where this would matter in Node.js but if you want to enumerate something more specific - I'm all ears
Clojure does a thing for inlined classes Foo$Bar
, which I kind of adopted for foo$macros
hrm, I guess I was thinking about the problems we encountered w/ Closure processing, and import and the need to go through default
property for the default
export
is this not a concern with A) Node.js because native ES6 support and B) Webpack handles it
closure processing will rewrite all commonjs to one single .default
property yes. but this is not relevant here.
JS packages will still have a default export, and in fact the strict mode webpack will also do the rewrite to .default
for commonjs
@thheller hrm then revisiting what you were saying yesterday about reshaping I guess we don't need reshaping if we consistently support invoking the imported lib as a fn?
but I guess that could be covered by support invoke always and making sure we don't prevent using it as ctor for some reason
doesn't matter for us as a compile-to-js language but this seems to be leading people down strange roads
where the do import Something from "x";
and then actually having all the names exported on Something
so Something.Foo
although the article is about dynamic import it applies just as much to static import