This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-25
Channels
- # announcements (2)
- # beginners (30)
- # biff (12)
- # calva (2)
- # cider (62)
- # clerk (18)
- # clj-commons (20)
- # clojure (9)
- # clojure-europe (6)
- # clojure-switzerland (1)
- # core-logic (6)
- # datomic (4)
- # events (3)
- # fulcro (1)
- # membrane (15)
- # off-topic (16)
- # portal (24)
- # practicalli (2)
- # releases (1)
- # rewrite-clj (45)
- # shadow-cljs (14)
- # tools-build (1)
- # xtdb (4)
Howdy folks!
I'm trying to migrate from lein-figwheel
to shadow-cljs
and I'm having a hard time š
(I'm using lein-shadow
to still be able to use lein
)
When I run lein shadow compile app
it says the following:
The required namespace "myapp.core" is not available.
Any hint as to what could be the issue?incorrect :source-paths
in project.clj
. note that I strongly discourage using lein-shadow
. you can just set :lein true
in shadow-cljs
and it'll use lein for dependency management
Oh interesting, I'll try this approach then
I think I'm getting there
I get this error when I try to browse to the server:
[:browser-repl] Build completed. (115 files, 0 compiled, 0 warnings, 1.50s)
cljs.user=> Mar. 25, 2023 9:45:43 A.M. io.undertow.server.Connectors executeRootHandler
ERROR: UT005071: Undertow request failed HttpServerExchange{ GET /}
java.lang.IllegalArgumentException: No implementation of method: :respond of protocol: #'shadow.undertow.impl/RespondBody found for class: java.nio.HeapByteBuffer
at clojure.core$_cache_protocol_fn.invokeStatic(core_deftype.clj:584)
...
Ahhhh so close I extended the protocol and now the handler is correctly served
(require 'shadow.undertow.impl)
(import '[io.undertow.server HttpServerExchange])
(extend-protocol shadow.undertow.impl/RespondBody
java.nio.ByteBuffer
(respond [buf ^HttpServerExchange exchange]
(let [out (.getOutputStream exchange)]
(while (.hasRemaining buf)
(.write out (byte-array [(byte (.get buf))])))
(.flush out))))
Unfortunately the compiled JS is nowhere to be found. Might just be a path issueOk, so running shadow-cljs watch app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build failure:
The required namespace "react" is not available, it was required by "reagent/core.cljs".
But I know react
is in the dependencies.
[reagent "0.10.0"]
[cljsjs/react-dom-server "16.13.0-0"]
[cljsjs/react-dom "16.13.0-0"]
[cljsjs/react "16.13.0-0"]
So why doesn't shadow-cljs
see it? :thinking_face:
note that I recommend running your own server, and not using the shadow-cljs dev-http as your server. hot-reload/repl will still work, even with your own server
Hi, I have hard time to make working this lib with Shadow-cljs https://github.com/cjohansen/portfolio. I miss surely some classpath config or something like that. Ex. The lib load dynamically some assets https://github.com/cjohansen/portfolio/blob/main/src/portfolio/client.cljs#L60 and use it's own resources here: https://github.com/cjohansen/portfolio/tree/main/resources/public/portfolio Is it possible to setup classpath to use resources coming from the jar ?
Perfect, I was on the right path but putting classpath:resources/public
, thanks!