Fork me on GitHub
#clojurescript
<
2024-06-09
>
leif20:06:30

Hey, I started getting this strange error when adding new javascript dependencies (using webpack), and I was curious if anyone else encountered it?:

Uncaught TypeError: goog.addDependency is not a function
    at deps.js:1:6
(anonymous) @ deps.js:1

leif20:06:11

This being my dev file:

^{:auto-bundle :webpack
  :watch-dirs ["src"]}
{:main slides.core
 :bundle-cmd
 {:none ["npx" "webpack" "--mode=development" "./src/js/bundle.js" :output-to
         "--output-path" :final-output-dir
         "--output-filename" :final-output-filename]
  :default ["npx" "webpack" "--mode=production" "./src/js/bundle.js" :output-to
            "--output-path" :final-output-dir
            "--output-filename" :final-output-filename]}}

leif20:06:11

In particular, I get the issue when adding mermaid from npm (https://github.com/mermaid-js/mermaid).

leif21:06:00

Hmm...this might actually be a figwheel related problem, but it does only seem to happen with mermaid, other dependencies seem to work fine.

bibiki23:06:54

hi. i started a small app with the following command lein new luminus firstapp +re-frame +shadow-cljs. later, i wanted to add a page that uses websocket to talk to backend. i checked the websocket's demo of luminus documentation and followed the instructions but i continuously got this error WebSocket is already in CLOSING or CLOSED state. I started another app with lein new luminus secondapp +cljs +immutant and followed the same instructions and i managed to reproduce the same effects as the documentation. then, i started a third application with lein new luminus thirdapp +re-frame +shadow-cljs +immutant and this time I copy pasted all files I wrote for my firstapp (those that I had prior to adding the websocket page and the file where I was integrating websocket interaction example) and things worked as I expected, no longer getting WebSocket is already in CLOSING or CLOSED state. would anybody know what could have been wrong? is there some kind of configuration that is different when generating an app with lein ... +immutant? the backend for firstapp has this in the stacktrace java.lang.IllegalArgumentException: No method in multimethod 'initialize-websocket' for dispatch value: :servlet which arises from the call to (async/as-channel request websocket-callbacks)

bibiki00:06:22

well, I replaced the dependencies part of project.clj in firstapp with that from project.clj in thirdapp. also, i replaced the line [ring.adapter.undertow.middleware.session :refer [wrap-session]] in firstapp's middleware.clj with [immutant.web.middleware :refer [wrap-session]] copied from thirdapp's middleware.clj and websocket page worked fine in firstapp also.

bibiki00:06:52

• also, the plugins part of project.clj files was different in the two apps