Fork me on GitHub
#shadow-cljs
<
2023-04-18
>
Pragyan Tripathi04:04:27

I added a build hook to build a css file. I keep getting following error:

[2023-04-18 10:12:03.228 - WARNING] :shadow.cljs.devtools.server.worker.impl/cljs-compile-ex - {:input {:code "(load-file \"/\")", :ns com.vadelabs.studio.client.ui.project.interface, :repl true}}
ExceptionInfo Failed to process REPL command {:eof? false, :ns com.vadelabs.studio.client.ui.project.interface, :form (load-file "/"), :source "(load-file \"/\")", :tag :shadow.cljs.repl/process-ex}
        shadow.cljs.repl/process-read-result (repl.clj:574)
        shadow.cljs.repl/process-read-result (repl.clj:548)
        shadow.cljs.repl/process-input (repl.clj:711)
        shadow.cljs.repl/process-input (repl.clj:689)
        shadow.cljs.devtools.server.worker.impl/eval19908/fn--19911 (impl.clj:698)
        clojure.lang.MultiFn.invoke (MultiFn.java:234)
        shadow.cljs.devtools.server.util/server-thread/fn--19548/fn--19549/fn--19557 (util.clj:283)
        shadow.cljs.devtools.server.util/server-thread/fn--19548/fn--19549 (util.clj:282)
        shadow.cljs.devtools.server.util/server-thread/fn--19548 (util.clj:255)
        java.lang.Thread.run (Thread.java:829)
Caused by:
ExceptionInfo can only load .cljs and .cljc files {:file-path "/"}
        shadow.cljs.repl/repl-load-file* (repl.clj:178)
        shadow.cljs.repl/repl-load-file* (repl.clj:173)
        shadow.cljs.repl/repl-load-file (repl.clj:231)
        shadow.cljs.repl/repl-load-file (repl.clj:229)
        shadow.cljs.repl/process-read-result (repl.clj:568)
        shadow.cljs.repl/process-read-result (repl.clj:548)
[:studio] Compiling ...
My shadow-cljs.edn looks like following:
:studio {:target :browser
                   :output-dir "bases/studio/resources/studio/js/"
                   :asset-path "/js/"
                   :build-options {:manifest-name "manifest.edn"}
                   :build-hooks [(com.vadelabs.studio.styles/build "bases/studio/resources/studio/css/styles.css")]
                   :module-hash-names true
                   :modules {:main {:init-fn com.vadelabs.studio.client.core/init
                                    :entries [com.vadelabs.studio.client.core]}}
                   :devtools {:after-load com.vadelabs.studio.client.core/refresh
                              :preloads [;; if using the chrome extension:
                                         com.fulcrologic.fulcro.inspect.preload

                                         ;; if using the electron app:
                                         ;com.fulcrologic.fulcro.inspect.websocket-preload
                                         com.fulcrologic.fulcro.inspect.dom-picker-preload
                                         com.vadelabs.studio.client.preload]}}
The hook function simply looks like following:
(defn build
  {:shadow.build/stage :flush}
  [build-state output-file]
  (css/build output-file)
  build-state)
any ideas on how can I resolve the issue? I get the error even if I remove css/build section in the above function.

thheller06:04:10

where is (load-file "/") coming from?

Pragyan Tripathi08:04:14

I tried to look into it… but couldn’t figure it out myself… When I remove .shadow-cljs and .cp-cache the first build works fine. But I start seeing these errors in subsequent builds.

thheller08:04:59

will need to find out where it is coming from. could be your editor?

thheller08:04:44

the log suggests that it is happening before compilation even starts

thheller08:04:53

so maybe your editor sends something before the file is saved?

Pragyan Tripathi08:04:41

I am using vscode with calva. Will check that out...