figwheel-main

cheewah 2022-05-03T03:18:51.565189Z

thanks https://app.slack.com/team/U6GNVEWQG , i tried restarting, waiting longer, refreshing the page and also using different browsers, but none work once i have :target :bundle. lsof also shows similar connections with/without using :target :bundle

athomasoriginal 2022-05-04T12:23:23.766719Z

Could you try to update your figwheel build to this instead?

^{:auto-bundle      :webpack
  :css-dirs         ["resources/public"]
  :watch-dirs       ["src" "test"]}
{:main learn-cljs.weather}
And see if your able to 1. still run the app (I don’t know what the src looks like) and 2. that you can connect via the REPL. (ensure you have webpack and webpack-cli installed as well)

cheewah 2022-05-04T16:06:01.233579Z

thanks. i changed dev.cljs.edn to above and still face the same issue deps.edn

{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
        org.clojure/clojurescript {:mvn/version "1.11.4"}}
 :paths ["src" "resources"]
 :aliases {:fig {:extra-deps
                 {com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
                  org.slf4j/slf4j-nop {:mvn/version "1.7.30"}
                  com.bhauman/figwheel-main {:mvn/version "0.2.17"}}
                 :extra-paths ["target" "test"]}
           :build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]}
           :min   {:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]}
           :test  {:main-opts ["-m" "figwheel.main" "-co" "test.cljs.edn" "-m" "learn-cljs.test-runner"]}}}
src/learn-cljs/weather.cljs
(ns ^:figwheel-hooks learn-cljs.weather)

(println "This text is printed from src/learn_cljs/weather.cljs. Go     ahead and edit it and see reloading in action.")

(defn mount-app-element []
  (println "mount called"))

;; conditionally start your application based on the presence of an "app" element
;; this is particularly helpful for testing this ns without launching the app
(mount-app-element)

;; specify reload hook with ^:after-load metadata
(defn ^:after-load on-reload []
  (mount-app-element))

cheewah 2022-05-04T16:08:07.029979Z

package.json

{
  "devDependencies": {
    "webpack": "^5.72.0",
    "webpack-cli": "^4.9.2"
  }
}

cheewah 2022-05-04T16:14:37.065939Z

i do notice the following though Figwheel says compiled output is dev/main.js and after bundling is dev/main_bundle.js:

[Figwheel] Compiling build dev to "target/public/cljs-out/dev/main.js"                                                                                                                                                                        
[Figwheel] Successfully compiled build dev to "target/public/cljs-out/dev/main.js" in 9.747 seconds.                                                                                                                                          
[Figwheel] Bundling: npx webpack --mode=development --entry ./target/public/cljs-out/dev/main.js --output-path ./target/public/cljs-out/dev --output-filename main_bundle.js
but in html i see it is still using the output dev-main.js (which is without using bundle).
<script src="cljs-out/dev-main.js" type="text/javascript"></script>
could this be the problem?

athomasoriginal 2022-05-04T20:19:02.489559Z

Do you see an error in your browser console saying it can’t find dev-main.js ? If yes, update your index.html script reference to dev/main.js

cheewah 2022-05-05T01:03:59.622639Z

i changed to <script src="cljs-out/dev/main_bundle.js" and it is working now. thanks athomasoriginal for all your helps 👍 ps: there was no error message in the browser console, probably because dev-main.js was still around due to previous build. i have :clean-outputs true but it seems to only clean up either based on current :target or the folder dev.

🎉 1
cheewah 2022-05-03T03:20:17.828649Z

think i will just try out other tool chain for now

athomasoriginal 2022-05-03T18:08:59.898899Z

Are there any other properties in your build file?

cheewah 2022-05-04T02:13:00.656079Z

dev.cljs.edn 's content

^{:watch-dirs ["test" "src"]
  :css-dirs ["resources/public/css"]
  :auto-testing true
  :log-file "figwheel-main.log"
  :log-level :trace
  :client-log-level :finest}
{:main learn-cljs.weather
 :clean-outputs true
 :target :bundle
 :bundle-cmd {:none ["npx" "webpack" "--mode=development"
                     "--entry" :output-to
                     "--output-path" :final-output-dir
                     "--output-filename" :final-output-filename]
              :default ["npx" "webpack" "--mode=production"
                        "--entry" :output-to
                        "--output-path" :final-output-dir
                        "--output-filename" :final-output-filename]}}
nothing in figwheel-main.edn

cheewah 2022-05-04T02:15:06.281769Z

the project is basically created from example provided by https://www.learn-clojurescript.com/ mainly just, saved the following to ~/.clojure/deps.edn

{:aliases
 {:new {:extra-deps {seancorfield/clj-new
                     {:mvn/version "1.1.243"}}
        :exec-fn clj-new/create
        :exec-args {}}}}
and run
clj -X:new :template figwheel-main :name learn-cljs/weather :args '["+deps" "--reagent"]'
then i just changed :target to :bundle and added :bundle-cmd . problem disappears if i comment out :target