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)
โYour host page will need to load the final bundled asset.โ doh
nvm
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
I can confirm the file is there, as the first log line indicates.
anyone any idea?, using latest cljs and figwheel-main 0.2.11
it seems you and I are having the same issue..
by your file path I assume you're using Mac OS, thus it should be a cross-platform issue because I'm using Linux
I have tried to fix it over the weekend using auto-bundle
and manual setup but I didn't have any luck!
what's your figwheel-main
version?
0.2.11, yes macOS
ah yeah i only just saw the details of your post.
i havenโt even tried the :auto-bundle yet
it sort of seems figwheel tries to read the file too soon by shelling out to npx too early or something.
ah, so @wcalderipe and I bumped into the same issue ๐
https://github.com/bhauman/figwheel-main/blob/4406e9eeb312b32058398f0614a479b763dba303/src/figwheel/main.cljc#L154 Could it be that this shelling out somehow runs too early?
would it be a problem with the webpack version?
No thatโs not it, manually running this npx command from my terminal (when main.js is definitely there), still yields this error
so, adding ./
in front would fix this
@wcalderipe $ npx webpack --mode=development ./target/public/cljs-out/dev/main.js -o target/public/cljs-out/dev/main_bundle.js
does run
{: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]}}
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:
@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
haha solid timing ๐
opened an issue for it
might even be able to make a PR soon, but gtg now
and it should probably be tested through various versions of webpack i assume? not sure what the policy is on this ๐
great, mate.. thanks for sharing!