kah0ona 2020-10-19T13:03:54.055300Z

Hi folks, in my host page, for figwheel, should i include the /cljs-out/dev/main.js or main_bundle.js? (just started using npm import feature as well)

kah0ona 2020-10-19T13:07:55.055500Z

โ€œYour host page will need to load the final bundled asset.โ€ doh

kah0ona 2020-10-19T13:07:58.055700Z


kah0ona 2020-10-19T13:16:08.056Z

Now I run into this:

[Figwheel] Successfully compiled build dev to "target/public/cljs-out/dev/main.js" in 28.101 seconds.
[Figwheel] Bundling: npx webpack --mode=development target/public/cljs-out/dev/main.js -o target/public/cljs-out/dev/main_bundle.js
[Figwheel:SEVERE] Bundling command failed
asset bundle.js 644 bytes [emitted] (name: main)

ERROR in main
Module not found: Error: Can't resolve 'target/public/cljs-out/dev/main.js' in '/Users/marten/Sites/clojure/aviationglass'

webpack 5.1.3 compiled with 1 error in 60 ms

kah0ona 2020-10-19T13:16:31.056500Z

I can confirm the file is there, as the first log line indicates.

kah0ona 2020-10-19T13:18:01.057200Z

anyone any idea?, using latest cljs and figwheel-main 0.2.11

wcalderipe 2020-10-19T13:35:36.057300Z

it seems you and I are having the same issue..

wcalderipe 2020-10-19T13:37:22.057500Z

by your file path I assume you're using Mac OS, thus it should be a cross-platform issue because I'm using Linux

wcalderipe 2020-10-19T13:38:25.057700Z

I have tried to fix it over the weekend using auto-bundle and manual setup but I didn't have any luck!

wcalderipe 2020-10-19T13:38:53.057900Z

what's your figwheel-main version?

kah0ona 2020-10-19T16:24:57.058200Z

0.2.11, yes macOS

kah0ona 2020-10-19T16:25:21.058400Z

ah yeah i only just saw the details of your post.

kah0ona 2020-10-19T16:25:34.058600Z

i havenโ€™t even tried the :auto-bundle yet

kah0ona 2020-10-19T16:26:04.058800Z

it sort of seems figwheel tries to read the file too soon by shelling out to npx too early or something.

kah0ona 2020-10-19T16:26:31.059300Z

ah, so @wcalderipe and I bumped into the same issue ๐Ÿ™‚

kah0ona 2020-10-19T16:35:27.060200Z Could it be that this shelling out somehow runs too early?

kah0ona 2020-10-19T16:48:53.060600Z

would it be a problem with the webpack version?

kah0ona 2020-10-19T16:52:01.061500Z

No thatโ€™s not it, manually running this npx command from my terminal (when main.js is definitely there), still yields this error

kah0ona 2020-10-19T16:53:25.061800Z

so, adding ./ in front would fix this

kah0ona 2020-10-19T16:54:15.062400Z

@wcalderipe $ npx webpack --mode=development ./target/public/cljs-out/dev/main.js -o target/public/cljs-out/dev/main_bundle.js does run

kah0ona 2020-10-19T16:59:01.063400Z

{:main       aviationglass.core
 :target     :bundle
 :output-to  "./target/public/cljs-out/dev/main.js" ;; the ./ at the beginning is somehow mandatory. 
 :bundle-cmd {:none ["npx" "webpack" "--mode=development" :output-to "-o" :final-output-to]}}

kah0ona 2020-10-19T17:00:03.064600Z

I figured this out by trying deliberately to run the cli command manually with a wrong filename, this yielded the exact same error. Then I just took a plunge and tried with ./ in front, and it compiled :man-shrugging:

kah0ona 2020-10-19T17:05:22.066400Z

athomasoriginal 2020-10-19T17:05:22.066500Z

@wcalderipe @kah0ona As was noted in your thread, try downgrading the webpack version of 4.xx. I ran into this last night and that resolves the issue. Of course, your solution of modifying the :bundle-cmd also works

athomasoriginal 2020-10-19T17:05:37.067100Z

haha solid timing ๐Ÿ˜‰

kah0ona 2020-10-19T17:05:38.067200Z

opened an issue for it

kah0ona 2020-10-19T17:05:55.067600Z

might even be able to make a PR soon, but gtg now

kah0ona 2020-10-19T17:06:19.068200Z

and it should probably be tested through various versions of webpack i assume? not sure what the policy is on this ๐Ÿ™‚

wcalderipe 2020-10-19T17:09:43.068600Z

great, mate.. thanks for sharing!