bhauman / figwheel-main

Figwheel Main provides tooling for developing ClojureScript applications
https://figwheel.org
Eclipse Public License 1.0
640 stars 93 forks source link

Main scripts not running :bundle-cmd with :bundle target. #292

Closed LeifAndersen closed 3 years ago

LeifAndersen commented 3 years ago

I am using webpack to build my application, and figwheel-main runs fine when using the -b and -bo flags. However, whenever I try to use the -m flag to run a main script, figwheel skips running the :bundle-cmd and tries to run the (unbuilt) target. Obviously this fails.

Here is my build file (test.cljs.edn):

^{:auto-bundle :webpack}
{:main application.core
 :bundle-cmd
 {:none ["npx" "webpack" "--mode=development" "src/js/bundle.js" :output-to
         "--output-path" :final-output-dir
         "--output-filename" :final-output-filename]
  :default ["npx" "webpack" "--mode=production" "src/js/bundle.js" :output-to
            "--output-path" :final-output-dir
            "--output-filename" :final-output-filename]}}

And I am running it with:

clojure -m figwheel.main -co test.cljs.edn -m application.test

(Obviously application.testprovides a function named -main.)

The error I get is:

Execution error (NullPointerException) at figwheel.main.util/dot-slash (util.clj:281).
Cannot invoke "java.io.File.toPath()" because the return value of "clojure.lang.IFn.invoke(Object)" is null

Edit:

Oh, I should probably mention I'm using figwheel-main 0.2.13, which I think is the latest version as of writing this.

b-boiko commented 3 years ago

I've been having the same issue. Downgrading to figwheel-main 0.2.11 seems to resolve the issue but I haven't spent enough time looking at the issue to discover why.

bhauman commented 3 years ago

Thanks for reporting this. Sorry I haven't gotten around to it yet. I'm looking at this right now. It looks like the changes I added to support Webpack 5 introduced this regression and it's only a problem for mains scripts using bundling.

I'll see what I can figure out.

bhauman commented 3 years ago

This is fixed, I will deploy the changes to 0.2.14-SNAPSHOT right now.