If I manually add a slash in paths to base and deps js files, then the error is gone. But the chestnut_app.js
file is located in the “compiled” folder, so after a new command (start) it breaks my application again.
if(typeof goog == "undefined") document.write('<script src="js/compiled/out/goog/base.js"></script>');
document.write('<script src="js/compiled/out/goog/deps.js"></script>');
document.write('<script src="js/compiled/out/cljs_deps.js"></script>');
Here is my project.clj
file:
(defproject chestnut-app "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.10.0"]
; DB
[seancorfield/next.jdbc "1.0.1"]
[org.postgresql/postgresql "42.2.6.jre7"]
[migratus "1.2.4"]
; React
[org.clojure/clojurescript "1.10.439" :scope "provided"]
[reagent "0.8.1"]
[metosin/reitit "0.3.9"]
[cljs-css-modules "0.2.1"]
[antizer "0.3.1"]
[cljs-http "0.1.46"]
; Server
[ring "1.7.1"]
[ring/ring-json "0.4.0"]
[ring/ring-defaults "0.3.2"]
[compojure "1.6.1"]
[crypto-password "0.2.1"]
[buddy/buddy-sign "3.1.0"]
[bk/ring-gzip "0.3.0"]
[radicalzephyr/ring.middleware.logger "0.6.0"]
[clj-logging-config "1.9.12"]
; Other
[org.clojure/test.check "0.9.0"]
[com.cognitect/transit-clj "0.8.313"]
[environ "1.1.0"]
[com.stuartsierra/component "0.3.2"]
[org.danielsz/system "0.4.1"]
[org.clojure/tools.namespace "0.2.11"]
[org.clojure/core.async "0.4.500"]]
:plugins [[lein-cljsbuild "1.1.7"]
[lein-environ "1.1.0"]
[lein-auto "0.1.3"]
[lein-sass "0.4.0"]
[migratus-lein "0.7.2"]]
:jvm-opts ["-Xverify:none"]
:sass {:src "src/sass"
:output-directory "resources/public/css"}
; MIGRATUS
:migratus {:store :database
:migration-dir "migrations"
:migration-table-name "_migrations"
:db {:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "//localhost/twitter"
:user "user"
:password "user"}}
:min-lein-version "2.6.1"
:source-paths ["src/clj" "src/cljs" "src/cljc"]
:test-paths ["test/clj" "test/cljc"]
:clean-targets ^{:protect false} [:target-path :compile-path "resources/public/js" "dev-target"]
:uberjar-name "chestnut-app.jar"
;; Use `lein run` if you just want to start a HTTP server, without figwheel
:main "chestnut-app.application"
;; nREPL by default starts in the :main namespace, we want to start in `user`
;; because that's where our development helper functions like (go) and
;; (browser-repl) live.
:repl-options {:init-ns user
:timeout 120000}
:cljsbuild {:builds
[{:id "app"
:source-paths ["src/cljs" "src/cljc" "dev"]
:figwheel {:on-jsload "chestnut-app.system/reset"}
:compiler {:main cljs.user
:asset-path "js/compiled/out"
:output-to "dev-target/public/js/compiled/chestnut_app.js"
:output-dir "dev-target/public/js/compiled/out"
:npm-deps {"moment" "2.24.0"}
:install-deps true
:source-map-timestamp true}}
{:id "test"
:source-paths ["src/cljs" "test/cljs" "src/cljc" "test/cljc"]
:compiler {:output-to "dev-target/public/js/compiled/testable.js"
:main chestnut-app.test-runner
:optimizations :none}}
{:id "min"
:source-paths ["src/cljs" "src/cljc"]
:jar true
:compiler {:main chestnut-app.system
:output-to "resources/public/js/compiled/chestnut_app.js"
:output-dir "target"
:source-map-timestamp true
:optimizations :advanced
:closure-defines {goog.DEBUG false}
:pretty-print false}}]}
;; When running figwheel from nREPL, figwheel will read this configuration
;; stanza, but it will read it without passing through leiningen's profile
;; merging. So don't put a :figwheel section under the :dev profile, it will
;; not be picked up, instead configure figwheel here on the top level.
:figwheel {;; :http-server-root "public" ;; serve static assets from resources/public/
;; :server-port 3449 ;; default
;; :server-ip "127.0.0.1" ;; default
:css-dirs ["resources/public/css"] ;; watch and update CSS
;; Start an nREPL server into the running figwheel process. We
;; don't do this, instead we do the opposite, running figwheel from
;; an nREPL process, see
;; https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl
;; :nrepl-port 7888
;; To be able to open files in your editor from the heads up display
;; you will need to put a script on your path.
;; that script will have to take a file path and a line number
;; ie. in ~/bin/myfile-opener
;; #! /bin/sh
;; emacsclient -n +$2 $1
;;
;; :open-file-command "myfile-opener"
:server-logfile "log/figwheel.log"}
:doo {:build "test"}
:profiles {:dev
{:dependencies [[figwheel "0.5.18"]
[figwheel-sidecar "0.5.18"]
[cider/piggieback "0.4.0"]
[cider/cider-nrepl "0.18.0"]
[lein-doo "0.1.11"]
[reloaded.repl "0.2.4"]]
:plugins [[lein-figwheel "0.5.18"]
[lein-doo "0.1.11"]]
:source-paths ["dev"]
:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}
:uberjar
{:source-paths ^:replace ["src/clj" "src/cljc"]
:prep-tasks ["compile"
["cljsbuild" "once" "min"]]
:omit-source true
:aot :all}})