Fork me on GitHub
#shadow-cljs
<
2018-04-07
>
geraldodev01:04:16

I've typed a sdfçlj asdlfkj asd on my cljs file, and It appeared as a Warning. Is that right ? I didnt see an Error yet, just Warning .

geraldodev01:04:37

Use of undeclared Var guts.http/asdlfkj

geraldodev01:04:01

Every non sensical word became Use of undeclared Var as a Warning

justinlee02:04:19

@troglotit if you mean webpack loaders like image loaders and css loaders, the answer is no, shadow doesn’t do that for you

levitanong05:04:24

is there a way to run a node js script via shadow-cljs? My workflow for a thing is, I compile a node script, then run it via node ..., and I’m looking for a cleaner way to do things.

tianshu11:04:45

@thheller try to write a target for react native, met this error.

JS runtime connected.
[2018-04-07 19:16:05 - ERROR] UT005071: Undertow request failed HttpServerExchange{ POST /worker/files/app/467f79fb-e0e5-4f7b-9df5-56e803f4cf44/1998cbc0-21d4-4a18-a69f-aa7b9dff54f0 request {Connection=[keep-alive], Accept=[*/*], Accept-Language=[en-us], Accept-Encoding=[gzip, deflate], Content-Type=[application/edn; charset=utf-8], Content-Length=[303], User-Agent=[HelloRN/1 CFNetwork/893.14 Darwin/16.7.0], Host=[0.0.0.0:9630]} response {}}
clojure.lang.ExceptionInfo: no output for id: [:shadow.build.classpath/resource "clojure/walk.cljs"] {:resource-id [:shadow.build.classpath/resource "clojure/walk.cljs"]}
	at clojure.core$ex_info.invokeStatic(core.clj:4739)
	at clojure.core$ex_info.invoke(core.clj:4739)
	at shadow.build.data$get_output_BANG_.invokeStatic(data.clj:168)
	at shadow.build.data$get_output_BANG_.invoke(data.clj:164)
	at $files_req$fn__19941.invoke(ws.clj:221)
	at clojure.core$map$fn__5587.invoke(core.clj:2745)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.RT.seq(RT.java:528)
	at clojure.core$seq__5124.invokeStatic(core.clj:137)
	at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:24)
	at clojure.core.protocols$fn__7835.invokeStatic(protocols.clj:75)
	at clojure.core.protocols$fn__7835.invoke(protocols.clj:75)
	at clojure.core.protocols$fn__7781$G__7776__7794.invoke(protocols.clj:13)
	at clojure.core$reduce.invokeStatic(core.clj:6748)
	at clojure.core$into.invokeStatic(core.clj:6815)
	at clojure.core$into.invoke(core.clj:6807)
	at $files_req.invokeStatic(ws.clj:245)
	at $files_req.invoke(ws.clj:173)
	at $process_req.invokeStatic(ws.clj:283)
	at $process_req.invoke(ws.clj:253)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:659)
	at clojure.core$apply.invoke(core.clj:652)
	at shadow.http.router$call_handler.invokeStatic(router.clj:12)
	at shadow.http.router$call_handler.invoke(router.clj:11)
	at shadow.cljs.devtools.server.web$root.invokeStatic(web.clj:160)
	at shadow.cljs.devtools.server.web$root.invoke(web.clj:159)
	at shadow.cljs.devtools.server$get_ring_handler$fn__21898.invoke(server.clj:60)
	at ring.middleware.resource$wrap_resource$fn__21453.invoke(resource.clj:37)
	at ring.middleware.resource$wrap_resource$fn__21453.invoke(resource.clj:37)
	at ring.middleware.params$wrap_params$fn__19405.invoke(params.clj:67)
	at shadow.cljs.devtools.server.ring_gzip$wrap_gzip$fn__21523.invoke(ring_gzip.clj:94)
	at shadow.undertow$ring_STAR_$reify__21609.handleRequest(undertow.clj:28)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
I found the code https://github.com/thheller/shadow-cljs/blob/0749e08322f5059e255fb3eb41a0f3c63c29c1d3/src/main/shadow/build/data.clj#L164

tianshu11:04:46

don't know why there's no clojure/walk in :output of state, there're clojure/string, clojure/data, etc.

Alex H15:04:29

I've just updated to shadow-cljs 2.2.25, and stuff that used to work in the JS interop stopped working; I'm requiring a js file (with ["/gen/editor" :as editor], which in turn requires some npm modules; some of those npm modules are in commonjs format, so I use a "const omit = require('ramda/src/omit') for example instead of an ES6 import, to avoid the .default

Alex H15:04:47

however, shadow-cljs (or cljs? or something?) now always seems to add .default to the uses of that

Alex H15:04:08

var omit$$module$gen$editor = module$node_modules$ramda$src$omit.default;

Alex H15:04:47

var module$node_modules$ramda$src$omit = shadow.js.require("module$node_modules$ramda$src$omit", {});

Alex H15:04:52

(in reverse order, sorry)

Alex H15:04:06

is there a way to avoid that automatic appending of .default to anything imported in JS?

Alex H15:04:15

it used to work on 2.0.138 as far as I can tell

Alex H16:04:10

this is what is in the cljs-runtime/module$node_modules$ramda$src$omit.js file: shadow$provide.module$node_modules$ramda$src$omit=function(e,k,a,p,f){e=a("module$node_modules$ramda$src$internal$_curry2")(function(a,e){for(var c={},f={},g=0,k=a.length;g<k;)f[a[g]]=1,g+=1;for(var p in e)f.hasOwnProperty(p)||(c[p]=e[p]);return c});p.exports=e}

Alex H16:04:11

somehow trying to revert to 2.0.138 causes all sorts of other weird issues now. great.

Alex H16:04:15

@thheller, any idea of how to work around that?

Alex H17:04:13

ok, interesting - they just broke compatibility with everything in closure compiler itself

Alex H17:04:26

doing import * as omit from 'ramda/src/omit' for example seems to work

Alex H17:04:56

on a slightly unrelated note, though, with the latest shadow-cljs I keep running into issues where it can't reload the js namespaces properly, though

Alex H17:04:02

when they get modified

Alex H17:04:10

in that reproducer repo (after fixing the import), I get:

Alex H17:04:18

[:app] Build failure: no source by provide: module$gen$abc {:provide module$gen$abc} ExceptionInfo: no source by provide: module$gen$abc

👍 1
stathissideris18:04:57

hello, I’m trying to follow this guide and it’s unclear to me what I need to do after I run shadow-cljs watch app

stathissideris18:04:12

the article seems to imply that my browser should load something

stathissideris18:04:25

is that automatic or do I have to point it somewhere?

orestis18:04:56

I don’t think shadow will open a browser. Which guide are you referring to?

Jon05:04:27

I changed the sentences a bit. Try if that helps.

Jon05:04:32

for short, you can tell shadow-cljs to start an HTTP server.

stathissideris18:04:47

thanks, reading

orestis18:04:52

It has an explicit config key to open a dev server in the shadow edn config.

stathissideris18:04:57

this guide is much more complete, many thanks

orestis18:04:25

Note that there is an official user manual that for some reason doesn’t appear very high on Google: https://shadow-cljs.github.io/docs/UsersGuide.html

stathissideris18:04:56

@orestis I did see that, but I think it’s better suited as a reference rather than a guide to a newcomer!

stathissideris18:04:19

I found myself jumping around in that manual, struggling to form a complete picture

stathissideris18:04:34

so another question: is figwheel still superior in terms of reloading?

orestis18:04:09

Yeah, the manual is a reference. I think a quick start guide would be helpful there.

orestis18:04:55

No idea about superiority, but it is claimed that shadow provides the necessary functionality.

orestis18:04:34

I lurk in this channel and I’m just repeating what I read :)

stathissideris18:04:21

good strategy 😄

thheller20:04:43

@alex340 the JS on the classpath stuff currenly only works with ES6. Closure processes CommonJS strangely and I don't know how to deal with that yet.