Fork me on GitHub
#shadow-cljs
<
2020-06-29
>
Chris McCormick09:06:41

is there a guide for self-hosting settings when using shadow-cljs? (per https://clojurescript.org/guides/self-hosting)

Lucy Wang10:06:59

AFAIK shadow-cljs requires JVM so it's not possible to run on self-hosted cljs

Chris McCormick12:06:52

perfect. thank you.

Chris McCormick12:06:14

On the blog post linked above it says: > Usually shadow-cljs does not require lein but it is required in this case since I’m using lein to build the shadow-cljs project. However i don't see lein being invoked.

thheller12:06:19

this only applies if you clone shadow-cljs which you should not do

thheller12:06:32

look at a standalone example. the example I made in the main shadow-cljs repo is not maintained and likely doesn't work anymore

kenny15:06:58

I continue to intermittently get an error like this when starting shadow-cljs:

------ ERROR -------------------------------------------------------------------
 File: /home/kenny/compute/monorepo/projects/ui/src/compute/ui/analytics/cloud_acct/view.cljs:44:12
--------------------------------------------------------------------------------
  41 | (defn CloudAccountsTable
  42 |   [{:keys [:integration/type]}]
  43 |   [table/Table
  44 |    #::table{:table-class "is-fullwidth"
------------------^-------------------------------------------------------------
No namespace: compute.ui.components.table found

--------------------------------------------------------------------------------
The compute.ui.components.table namespace is required in the view file references in the above error. The error seems to magically disappear and reappear with no clear way to reproduce it. Previously Thomas thought this was due to a dependency conflict with the reader. Looking at the output from clj -Stree, I can see org.clojure/tools.reader 1.3.2 is coming directly from thheller/shadow-cljs 2.10.13. Has anyone else been hitting this? Workarounds? I have not been able to come up with something that will consistently fix the issue.

kenny15:06:34

It occurs with anything that uses the namespaced map reader (e.g., #::table )The only solution I can think of is to not use that anymore. I would think shadow would be compatible with it though.

thheller15:06:56

This error isn't from shadow-cljs. so no clue what would cause it.

kenny16:06:02

It started happening several weeks ago when updating to the latest shadow version. Perhaps it's some sort of issue with cljs?

kenny16:06:35

It feels like some sort of race condition due to the intermittency.

thheller16:06:39

I don't know. never seen it myself.

thheller16:06:37

if the namespace has a proper require for the alias table then race condition shouldn't really happen since that ensures the ns is compiled before

kenny16:06:45

It's quite consistent. 3 other devs on my team have been hitting it. Another "workaround" is to have shadow reload the "problem" namespace (in this case compute.ui.components.table) by creating a trivial change and saving.

thheller16:06:58

I don't know. maybe look at the tools reader source or whereever that error is from

kenny16:06:10

There's no stacktrace.

thheller16:06:19

yeah thats weird too

kenny16:06:28

There's a bit more code in the error message but literally nothing else.

thheller16:06:43

hmm its not even in tools reader

kenny16:06:26

It's almost like these are false errors :man-shrugging::skin-tone-2:

thheller16:06:54

ah the error is from clojure

thheller16:06:21

still doesn't explain it though

kenny16:06:45

Were you looking for where "No namespace: %s found" occurs?

thheller16:06:27

apparantly on the-ns but shadow-cljs also never uses that

thheller16:06:09

yeah no clue. don't have time to dig deeper now.

thheller16:06:18

would help a lot if you reproduce this somewhere

thheller16:06:33

are you maybe using the embedded variant and use tools.namespace in CLJ?

thheller16:06:41

or is this running standalone?

kenny16:06:49

Hmm. I've tried for weeks to get a reliable repro. Every time I try, the error magically goes away.

kenny16:06:27

> are you maybe using the embedded variant and use `tools.namespace` in CLJ? Afaik, no use of tools.namespace. > or is this running standalone? We start shadow with npx.

kenny16:06:45

npx shadow-cljs watch app devcards

kenny16:06:14

Sometimes deleting .shadow-cljs helps.

kenny16:06:59

fwiw, compute.ui.components.table is a .cljs file not .cljc and no .clj counterpart.

lilactown22:06:57

could there be something in the compute.ui.components.table namespace preventing it from being parsed?

lilactown22:06:13

I remember running into this at work as well, I can't remember how we fixed it

kenny23:06:01

I don't think so. Changing the keywords from the reader map syntax to regular keywords fixes the issue. The intermittency is also strange.

kenny00:06:29

@U05224H0W Would you like me to open an issue for this?

fabrao23:06:42

hello all, how do you use font-end shadow-cljs and back-end in the same port in dev mode? I mean, start shadow-cljs and something like ring to provide shadow-cljs reload?

thheller23:06:44

you make your backend server serve the static files shadow-cljs generates

fabrao23:06:01

can I use something like hiccup to generate the html5?

fabrao23:06:36

How shadow-cljs communicate with browser to do hot-reload?

thheller23:06:52

websocket to the shadow-cljs watch process

fabrao23:06:43

so, when html5 "render" like app.js is that time both communicate?

thheller23:06:16

sorry too tired for this. shadow-cljs produces JS files. it doesn't matter what you use to serve them and your server doesn't need to do anything to "enable" shadow-cljs. just serve static files.

fabrao23:06:40

sorry about asking this dumb question, because I came from lein figwheel that does all the stuffs for us

lilactown23:06:29

@fabrao there are a number of shadow-cljs templates out there - it might be worth looking at how they work and deconstructing them

fabrao23:06:54

ok, last project I used helix and graphql in separated projects because I didn´t know how to join both

fabrao23:06:32

now I´m trying to join both in the same project, thank you