Fork me on GitHub
#shadow-cljs
<
2020-02-01
>
mpostma01:02:25

hello, I am trying to deploy my shadow-cljs/reagent app to github pages, but i can't make it work. When I use shadow-cljs watch app everything works just fine, but when i run shadow-cljs release app and try to open index.html or push the code to my github page, I get this js error : Error: No matching clause: . At first I thought that the app.js generated by the release command was faulty, but it seems to work just fine when i run it with a http server (lite-server). In all case the code is loaded just fine. It's just really confusing. What am I missing?

sichacvah07:02:36

Hello! Are there some examples or articles of testing react-native project with shadow-cljs?

thheller09:02:58

@postma.marin my guess would be that your routing fails but its hard to say. you can run shadow-cljs release app --pseudo-names or shadow-cljs release app --debug (to get source maps). should be easier to tell where it fails then

robert-stuttaford10:02:24

can :target :browser live in :build-defaults?

mpostma11:02:08

@thheller thanks! 🙂 it was indeed a routing problem!

jmckitrick13:02:54

I made progress. I got the CLJS part built with shadow, and then built the uberjar. When I run the app and view the start page, it’s missing JS. The console says:

jmckitrick13:02:07

The resource from "" was blocked due to MIME type ("text/html") mismatch (X-Content-Type-Options: nosniff).

thheller13:02:57

@jmckitrick that is your server. looks like it tries to serve some other content under that url that isn't the JS. just open it in your browser normally and see what it is

jmckitrick13:02:20

I went back to the dev build, and am starting over. I’ll worry about the uberjar when I’m ready for deployment.

jmckitrick13:02:43

I think I had too many moving parts at once.

jmckitrick19:02:38

So loading that file in the browser gives me a 404 page

jmckitrick19:02:00

So the uberjar isn’t finding the payload generated by shadow, I assume.

jmckitrick19:02:27

Probably a simple setting in my project file… just gotta find it.

Saikyun20:02:19

hey @thheller, when running a prepl-server and a socket-server, if I connect to the prepl-server I can't seem to start a repl in the socket-server

Saikyun20:02:42

after connecting to the socket-server I get this:

shadow.user=> (shadow/repl :app)
null=> Execution error (AssertionError) at shadow.cljs.repl/read-one (repl.clj:536).
Assert failed: (symbol? read-ns)

Saikyun20:02:56

is this something that's known, or should I create a repro + issue?

thheller20:02:56

don't really understand what you are doing?

thheller20:02:35

neither prepl nor socket-repl are used frequently so yeah there are most certainly issues

Saikyun13:02:24

ah, all right.

Saikyun13:02:42

sorry for being unclear, what I was doing is starting a prepl-server by putting {:prepl {:app 5555}} in shadow-cljs. I can connect to the prepl-server and it works fine. however, if I have a prepl-server running, and then connect to the socket-server, then I get the error I posted (`null=> Execution error (AssertionError) at shadow.cljs.repl/read-one (repl.clj:536).`)

Saikyun14:02:53

either way, if it's not used much, don't bother about it. 🙂

thheller14:02:29

I just need to reproduce it before I can look at it

thheller14:02:58

by socket-server I assume you mean you also configured :socket-repl {:port 1234}?

thheller14:02:40

I'm mostly lacking context for what you are doing .. there are too many things that you could be doing so I can't tell

Saikyun08:02:09

I can just make a repro-repo and send it to you instead 🙂

darwin22:02:13

I have an interesting problem here, I require react as an npm module. I have a macro which emits react/createElement. I cannot do that in my macro because compiler complains (I guess due to that “react” is not normal namespace, it is coming from npm, with normal namespaces this normally works). When I create some alias (def my-create-element react/createElement) and emit my-ns/my-create-element instead. All works, but release build suffers from generating dynamic arity dispatch. Even if I specify explicit fixed arity (defn my-create-element [x] (react/createElement x)) it does not get inlined in advanced mode (verified with --pseudo-names). Any ideas, how could I reference react/createElement in my macro directly? js/React.createElement does not work. “React” is not avail at runtime due to way how shadow isolates npm modules (?)

darwin22:02:19

this is closest how I could get to what I want: https://github.com/binaryage/cljs-react-three-fiber/commit/1d23a5050c540a19804182dfcb1545eb09356f92 that dirty set! emits: window.reactCreateElement=$APP.vl.createElement I need a way how to reference that $APP.vl (react npm import in my macro)