Fork me on GitHub
#helix
<
2020-11-30
>
adkelley15:11:37

I’m testing out ClojureScript with Webpack. Does anyone have an example of build.edn and deps.edn files for helix? Thanks.

geraldodev20:11:18

@alex.kelley Do you use shadow-cljs for compilation ?

adkelley20:11:23

@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.

geraldodev21:11:08

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.

geraldodev21:11:54

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.

lilactown21:11:57

@alex.kelley I haven't tried the :bundle target with webpack yet. Is there something specific that you're getting stuck on?

geraldodev21:11:03

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.

adkelley21:11:31

@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.

3
❤️ 3