looks great! left a comment
well that was easy - the bundle stuff just works - very minor change
I could make a project that used react & react-dom no config, run webpack - dev and advanced worked fine
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
Do you have one of these repos publicly as an example?
not yet - there's a couple of other UX things I'd like to think through
but this is really zero config
{:main cljs-bundle.core :output-to "out/index.js" :output-dir "out" :target :bundle}
that's it, :bundle
handles all the options you need for you
the output file can be handed over to whatever bundler that understands require
that you want to use
no custom index.js
, no manual :global-exports
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
But very excited for this direction. Thanks for the thinking and the work
to clear the above is bigger than just usability as I've said before
you can now publish a CLJS JAR that use node_modules and people can consume it and expect it to work reproducibly
across all tools
note this means also making something that works for React Native (outside the REPL bits) is trivial
because it's exactly the same as webpack
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
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?
in the case of RN (i.e. Metro) nothing - the CLJS tooling will need to do it
but you can now focus on the parts that differentiate CLJS from JS dev
CLJS works as JS tools expect for JS deps
but I think a bigger impact for example will be shared wrapper for Reagent
every Reagent RN project has this boilerplate around mapping RN components to Reagent
that can just go away - you can make a dep now that people can just use
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
@mfikes we should probably repurpose the :aot-cache
stuff for project local files
we end up doing a lot of work when switching between :none
and :advanced
which is uninteresting
Oh, right. :advanced
implies a lot of build-affecting options change.
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
{:main cljs-bundle.core
:output-to "out/index.js"
:output-dir "out"
:target :bundle
:bundle-cmd {:none ["npx" "webpack" "--mode=development"]
:default ["npx" "webpack"]}}
added :bundle-cmd
to master - with that in place running a :none
build w/ REPL and :advanced
build feels more or less like ClojureScript
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.
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)
Similar here, I use code-splitting a lot and is especially NB for browser-apps that consume NPM stuff (which can be large)