Fork me on GitHub

Hello, How can I conditionally use different :source-paths for dev and release? thanks.

thheller10:12:13 with shadow-cljs.edn you can't. I consider this an anti-pattern that should be avoided so its not supported out of the box. you can do it when using deps.edn or project.clj if you really need to


then I should use two different files in the same source path for dev and prod? Is that ok?


what are you trying to do? what do you mean by "two different files"?


this is usually an anti-pattern in shadow-cljs because it does things differently then other tools. so the problem that this pattern is trying to fixed is already fixed. see

👍 3
Pavel Klavík10:12:22

Hi, the REPL problem we discussed occured to me right now and I noticed the following output in browser console:


sorry I talk to too many people. which problem? 😛


that looks like a regular repl load sequence so I don't see the issue?

Pavel Klavík13:12:52

the bug where requires are lost, occurs sometimes

Pavel Klavík13:12:17

[reposting the original report] Hi, it happens to me quite frequently (several times every day) that while doing changes in the code, Shadow-cljs REPL stops working correctly and I have to restart Shadow to make it working again. [4:09 PM] For instance, I get the following in Cursive nREPL:

(clojure.string/join ["ab" "cd"])
Timeout while waiting for result.
[4:10 PM] And shadow-cljs outputs this into console:
[2020-12-16 16:07:58.625 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:op :cljs-load-sources, :sources [[ "cljs/spec/gen/alpha.cljs"] [ "cljs/spec/alpha.cljs"] [ "cljs/repl.cljs"] [:shadow.cljs.repl/resource "cljs/user.cljs"]], :call-id 6, :from 71}}
ExceptionInfo no output for id: [:shadow.cljs.repl/resource "cljs/user.cljs"] {:resource-id [:shadow.cljs.repl/resource "cljs/user.cljs"]}! (data.clj:197)! (data.clj:193)
        shadow.cljs.devtools.server.worker.impl/fn--15184/fn--15187 (impl.clj:813)
        clojure.core/map/fn--5866 (core.clj:2753)
        clojure.lang.LazySeq.sval (
        clojure.lang.LazySeq.seq (
        clojure.lang.RT.seq (
        clojure.core/seq--5402 (core.clj:137)
        clojure.core.protocols/seq-reduce (protocols.clj:24)
        clojure.core.protocols/fn--8146 (protocols.clj:75)
        clojure.core.protocols/fn--8146 (protocols.clj:75)
        clojure.core.protocols/fn--8088/G--8083--8101 (protocols.clj:13)
[4:10 PM] Any idea what could be causing this or how I could debug where is the problem? [4:12 PM] Also, all previous requires are lost when this happens. So for instance, I run the following code before:
(require '[orgpad.client.db.get :as db-get])
=> nil
I can use functions from db-get perfectly fine. After this, I can't call them and I get this error in REPL:
------ WARNING - :undeclared-ns ------------------------------------------------
 Resource: <eval>:1:2
 No such namespace: db-get, could not locate db_get.cljs, db_get.cljc, or JavaScript source providing "db-get" (Please check that namespaces with dashes use underscores in the ClojureScript file name)

------ WARNING - :undeclared-var -----------------------------------------------
 Resource: <eval>:1:2
 Use of undeclared Var db-get/latest-editor


please open a github issue if you want to get any kind of progress on this. there is far too much going on in slack for me to keep track of it all.

Pavel Klavík13:12:32

ok, I will do that 🙂


I do remember this now but still don't have a clue what is going on and also still can't reproduce it

Pavel Klavík13:12:05

Seems to be related, I will put it there


This might be a super dumb question but I'm not familiar with frontend. I'm using reagent with shadow-cljs, when I do shadow-cljs release should I be able to serve the app just from my browser by opening index.html or will I always need a webserver?


you'll need a webserver. in that index.html will be a reference to your js bundle that the browser will attempt to fetch. without a webserver that fetch will fail


among likely other things like css and images


thats not entirely true. you can load it directly from the filesystem but you are going to be limited in what you are allowed to do since browsers restrict some stuff if loaded from disk


its best to use a server


ok so basically I can't host it on github pages or S3?


i thought github pages and s3 both can do this. that yep meant those things will work? also, netlify makes this amazingly easy


haha didn't see the "can't". just read "can". sorry. yes of course those are fine.

👍 6

anything that speaks http and knows how to serve files is fine.


hello, I'm trying to use imported like #?(:cljs ["@kunukn/react-collapse" :default Collapse]) but when it's rendered this happens:

ERROR [com.fulcrologic.fulcro.react.error-boundaries:31] - Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
first time I've run into an error like this, not sure if there's something special about importing this module into shadow-cljs?


version is shadow-cljs 2.11.10


likely means that Collapse is nil. might be :as Collapse or :refer (Collapse)


oh, it was :as Collapse


I only tried :refer; didn't even know you could import a whole class like a ns


is there some rule for when that needs to be done? I see export default Collapse in the library, so I thought it'd be a default export


thanks a lot though :)

David Pham20:12:18

Yeah, what is the rule? I usually have to make trial and errors haha