Fork me on GitHub
#cljs-dev
<
2020-04-11
>
dnolen00:04:44

looks great! left a comment

dnolen20:04:49

well that was easy - the bundle stuff just works - very minor change

dnolen20:04:23

I could make a project that used react & react-dom no config, run webpack - dev and advanced worked fine

👀 4
dnolen20:04:30

the way this is done - zero impact on any existing tooling - since it doesn't really change anything at all - it just makes it easy to run webpack on our output

dpsutton20:04:45

Do you have one of these repos publicly as an example?

dnolen20:04:58

not yet - there's a couple of other UX things I'd like to think through

dnolen20:04:01

but this is really zero config

dnolen20:04:27

{:main cljs-bundle.core :output-to "out/index.js" :output-dir "out" :target :bundle}

dnolen20:04:57

that's it, :bundle handles all the options you need for you

dnolen20:04:20

the output file can be handed over to whatever bundler that understands require that you want to use

dnolen20:04:54

no custom index.js, no manual :global-exports

dpsutton20:04:57

Because of figwheel and shadow I’ve never used webpack beyond the simple example on http://clojurescript.org. So was interested in the whole thing if you already had it made

dpsutton20:04:22

But very excited for this direction. Thanks for the thinking and the work

dnolen20:04:43

to clear the above is bigger than just usability as I've said before

dnolen20:04:15

you can now publish a CLJS JAR that use node_modules and people can consume it and expect it to work reproducibly

dnolen20:04:23

across all tools

dnolen20:04:53

note this means also making something that works for React Native (outside the REPL bits) is trivial

dnolen20:04:02

because it's exactly the same as webpack

dnolen20:04:44

it's definitely something I found disconcerting about the existing CLJS RN integrations (except probably shadow) - overly complicated because there wasn't access to a few important things

👍 8
dominicm21:04:56

RN will be huge. For live reloading, will that now be down to the bundler to provide? And do I need to run clojurescript in auto rebuild to get that?

dnolen21:04:45

in the case of RN (i.e. Metro) nothing - the CLJS tooling will need to do it

dnolen21:04:09

but you can now focus on the parts that differentiate CLJS from JS dev

dnolen21:04:25

CLJS works as JS tools expect for JS deps

dnolen21:04:43

but I think a bigger impact for example will be shared wrapper for Reagent

dnolen21:04:01

every Reagent RN project has this boilerplate around mapping RN components to Reagent

dnolen21:04:10

that can just go away - you can make a dep now that people can just use

dnolen22:04:49

what I'm looking really forward to is seeing people push more stuff that may be locked up in their apps that could be open source / reusable but there wasn't a practical way for it to work for a wide number of users

dnolen23:04:10

@mfikes we should probably repurpose the :aot-cache stuff for project local files

dnolen23:04:40

we end up doing a lot of work when switching between :none and :advanced which is uninteresting

mfikes23:04:18

Oh, right. :advanced implies a lot of build-affecting options change.

dnolen23:04:31

I think with that in place + the global :aot-cache I think most of the time could be spent only in Closure for advanced builds

dnolen23:04:50

{:main cljs-bundle.core
 :output-to "out/index.js"
 :output-dir "out"
 :target :bundle
 :bundle-cmd {:none ["npx" "webpack" "--mode=development"]
              :default ["npx" "webpack"]}}

dnolen23:04:41

added :bundle-cmd to master - with that in place running a :none build w/ REPL and :advanced build feels more or less like ClojureScript

👍 8
dnolen23:04:49

I think the only feature that you will lose going down this path is optimal code-splitting, but after all the work that we've put into it still feel like something only hardcore user reach for.

orestis06:04:53

Is optimal code-splitting different than ordinary code splitting? Is this the thing that shadow-cljs does?

orestis06:04:28

Excuse my ignorance, I am only exposed to the way shadow-cljs does things :)

dnolen23:04:44

so I think it's a fair tradeoff - curious what folks think that are using CLJS directly w/ code-splitting and foreign libs (who would like the new convenience of the bundle approach)

orestis06:04:20

Not sure if that’s us - we use shadow for npm stuff and it also handles code-splitting. Kind of a necessity when eg we use Vega which is 1mb of JS.

mhuebert07:04:20

Similar here, I use code-splitting a lot and is especially NB for browser-apps that consume NPM stuff (which can be large)