I’m testing out ClojureScript with Webpack. Does anyone have an example of build.edn
and deps.edn
files for helix? Thanks.
@alex.kelley Do you use shadow-cljs for compilation ?
@geraldodev Yes, I have in the past, and it works fine. Given that ClojureScript >1.10.741 is https://clojurescript.org/news/2020-04-24-bundle-target ClojureScript with Javascript Bundlers, such as Webpack, I thought I’d give it a try with Helix.
I'm glad that shadow-cljs postponned the necessity of using webpack until I needed to run a css loader. I discovered shadow-cljs with fulcro-template . I still use fulcro template as a base (remove fulcro and pathom) and use the rest.
with shadow-cljs.edn I have :js-options {:js-provider :external :external-index "target/js_libs_for_webpack.js"} and I process that with a simple enough (i hate webpack config) file.
@alex.kelley I haven't tried the :bundle
target with webpack yet. Is there something specific that you're getting stuck on?
I'm glad that cljs has the ability of consuming npm libraries, but shadow-cljs was ahead on that (experimenting, leading the way) It looks like.
@lilactown I just got it working using your example in the README! Here’s the build.edn
file:
{:main hello-bundler.core
:output-to "out/index.js"
:output-dir "out"
:target :bundle
:bundle-cmd {:none ["npx" "webpack" "./out/index.js" "-o" "./out" "--mode=development"]
:default ["npx" "webpack" "./out/index.js" "-o" "./out"]}
:closure-defines {cljs.core/*global* "window"}} ;; needed for advance
Here’s the deps.edn
file:
{:deps {org.clojure/clojurescript {:mvn/version "1.10.773"}
lilactown/helix {:mvn/version "0.0.13"}}}
Both clj -M -m cljs.main -co build.edn -v -c -r
and clj -M -m cljs.main -co build.edn -O advanced -v -c -s
work correctly.