Fork me on GitHub
#shadow-cljs
<
2020-06-10
>
lilactown00:06:55

it says that the thheller/shadow-cljs dependency is being ignored

lilactown00:06:01

not all of them

lilactown00:06:17

you don’t need to specify the version of shadow-cljs in shadow-cljs.edn. you specify it package.json

fabrao00:06:36

that´s what I did

fabrao00:06:20

the error message gone, thank you, again

entropy03:06:28

I'm looking into splitting my cljs code into modules, and using shadow.lazy to load the code dynamically on my SPA. In production I have static assets fronted by nginx and served by a CDN. After digging into it a little I can't figure out how a call to shadow.lazy/load translates into a web request, and I can't confirm whether or not it's still going to play well with my setup in production. Any pointers are greatly appreciated!

tekacs06:06:31

I'm seeing $jscomp errors on 2.10.5, with :output-feature-set :es6 set. I'm able to work around it by setting :output-feature-set :es-next although that seems like a less-than-ideal workaround? The $jscomp errors appear to be linking back (through sourcemaps) to places where my NPM depdendencies are using async or other later-than-ES6 features in their original (not distributed) source -- a specific example of this from my dependencies is react-hook-form . On that hunch I switched to the :es-next feature set, but I assume this is some kind of issue with polyfills being used? I'll try to reduce this example down at some point, but hopefully the tracing back to the use of async is at least somewhat informative! Potentially relevant to https://github.com/thheller/shadow-cljs/issues/709 ?

Schpaa06:06:52

how can I check the version of shadow-cljs I’m running???

Schpaa06:06:06

doesnt response to -v, and the help screen shows nothing

thheller07:06:24

@schpaencoder the version is printed on every startup?

Schpaa07:06:59

I know it used to

Schpaa07:06:46

prob. something with the container

thheller07:06:53

still does. just doesn't print the CLI version anymore since thats less useful

Schpaa07:06:17

I beg to differ

thheller07:06:38

shadow-cljs info also has all the info

Schpaa07:06:14

I was looking for info, but thought about version

thheller07:06:20

run shadow-cljs watch app or whatever and paste the output. I'd be very surprised if it didn't print the info on startup 😛

Schpaa07:06:52

it’s just that my brain looks for -version and never -info

Schpaa07:06:00

case solved

thheller07:06:55

@guaqueta shadow.lazy basically just figures out which module the namespace is in your are referencing and then loads that via :asset-path + <module-id>.js

thheller07:06:43

using shadow.loader. you may set :module-loader-init false in your build config but then must call (shadow.loader/init "") before actually using the loader anywhere (eg. first thing in :init-fn)

entropy17:06:32

Thanks for the reply, I think this is exactly what I needed (also, thanks for shadow-cljs, it's been super helpful).

thheller17:06:33

forgot to mention that :asset-path also controls all of this

thheller17:06:31

so if you set that to a full URL at build time it will be used. eg :asset-path "" will end up loading your modules from there. so :modules {:main ...} would be

entropy17:06:48

Oh, neat. How would I configure :asset-path to have different values for dev vs prod builds?

thheller17:06:09

:release {:asset-path ""}

entropy17:06:39

Also, just for context: I was trying to catch the loader in action, so to speak. So in dev I added a middleware to my ring app to priint out all requests, and then I was hoping to see the request for the new module come through at the appropriate time (i.e. when I interact with my app in a way that should trigger the load). My app works as expected, so the new code clearly is getting loaded, but I just don't see the request that actually fetches the js file. I dug around a bit and saw that shadow.loader uses google module manager which in turn uses bulkloader which in turn uses Xhrio, so it should just come down to a web request for that asset. I'm probably just missing something obvious and now I've rambled for too long, but anyways that's where I was coming from.

entropy17:06:31

oh and thanks for that link, I should have just read the docs before asking that.

thheller17:06:40

just look at the browser console to see when the requests happen

thheller17:06:13

but yes they are regular xhr requests fetching the sources. "when" depends entirely on how you use it.

entropy17:06:17

Indeed, I do see the requests in the browser console happening when I expect them. I must have done something dumb in my logging middleware.

thheller07:06:59

if you must use a dynamic url that is

thheller07:06:00

@tekacs for starters it would help to know which npm package is causing the issue. might give me something reproducible.

tekacs16:06:58

sorry if I wasn't clear -- it's the use of react-hook-form -- specifically when it uses any later-than-ES6 features like async functions.

Aron11:06:57

I am doing something wrong again. I ran into this issue: https://github.com/bhauman/devcards/issues/168 tried to add the config that fixes it, and I get IllegalArgumentException: Wrong number of args passed to keyword: :ns-aliases

Aron11:06:40

I tried to search for the docs for ns-aliases in both the shadow-cljs user guide, shadow-cljs github repo, and in clojurescript docs, I didn't see it anywhere.

thheller11:06:47

Wrong number of args passed to keyword: :ns-aliases

thheller11:06:53

whats your exact config?

Aron11:06:26

the ns-aliases I copied from that github issue.

Aron11:06:37

Should I share the full config file?

Aron11:06:48

I reverted to 0.2.6 devcards and that works fine still, so I am not stuck with this, to be honest, if devcards is this troubling, I think I should move to a different lib that has similar features, I think I saw a couple.

thheller11:06:21

workspaces is nice

thheller11:06:11

the devcards thing I about getting :bundle to work I think. there isn't really any clear guidance on how that is supposed to work with foreign-libs in regular CLJS yet. not sure how that will turn out.

Aron12:06:10

workspaces is the one I remember clearly as an alternative, yes. I am all for reducing configuration. When I have to use undocumented config options to make something work, that's exactly when I know my colleagues will complain.

Aron12:06:32

I think I saw it somewhere mentioned that you also don't want to encourage people using ns-aliases, I suspect that's the reason I couldn't find it. Or that I missed it, but it's there, which is always an option : )

rickmoynihan12:06:03

trying to debug why I’m getting a “No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.” message from shadow-cljs. It works in my dev environment, but I’m trying to debug something in my test env, so my app is started up in test mode on a different port.

rickmoynihan12:06:57

which makes sense… but not sure how to debug what is missing

rickmoynihan12:06:41

I can see main.js is served in my test app, and it appears to be the same one that is built for dev app… as moving it causes it to 404

rickmoynihan12:06:20

ahh its ok I’ve fixed it

bendlas13:06:00

I'm embedding shadow components with a modularized build as cross - origin. In the dev-setup (containerized hosts), the page tries to load its source-maps from the embedding host, instead of the origin. Probably because shadow loads its code via eval, in this mode. :devtools-url doesn't show any difference either, so I'm creating a route in the embedding service, as a workaround for development. Does shadow also want a ticket for this?

thheller14:06:25

@bendlas I don't quite understand what you are asking. if the eval-loader is a problem you can use :devtools {:loader-mode :script} in your build config to go back to regular script tags or fetch

bendlas14:06:43

thanks for the hint, I'll try that.

jjttjj14:06:38

Can I get the main.js (or other entry js files) javascript source code from the shadow compiler state map after compiling? I can't seem to find where it would be

thheller14:06:50

:devtools-url only really controls the websocket connection. it doesn't have anything to do with how the code is loaded into the page initially

bendlas14:06:15

i figured ..

fabrao14:06:12

hello all, is there any project to work with deno? My hard disk is fulled with

fabrao14:06:21

node_modules

thheller14:06:22

delete them if you don't need them? 😛

thheller14:06:47

I mean switching to deno would just give you deno_modules or whatever the name for the directory it uses is

fabrao14:06:05

hahah, NOOOO, I want to center all the libs as with .m2

thheller14:06:34

ah, right. forgot it uses a shared cache.

fabrao14:06:35

each node_modules take 300 Mb of files

fabrao14:06:14

and besides about the security way that it works

fabrao14:06:34

works -> deno

thheller14:06:37

well security is rather useless given that you need to give all the permissions if you want websocket REPL and hot-reload to work

thheller14:06:07

deno is interesting but I don't quite see the point for CLJS given how restrictive it is

fabrao14:06:37

maybe I can use linked folder for a node_module shared

fabrao14:06:57

do you know if any1 tried this?

thheller14:06:41

no clue. I barely use any node_modules myself anymore.

fabrao14:06:14

well, how do you use with shadow-cljs?

fabrao14:06:25

and package.json?

Aron14:06:03

do you have many of these 300mb node_modules? I think I got to some GBs in all my repos together, but it's not terribly overwhelming, not even on a smallish laptop ssd

fabrao15:06:09

@ashnur I have many projects that use node_modules, and I heard about deno.

Aron16:06:07

have you heard about tink? https://github.com/npm/tink

fabrao21:06:45

Hello, have you tried?

Aron06:06:34

No, because at the time I heard about it was at the very beginning. I didn't realize that the development seemingly stopped last year.

bendlas15:06:29

Switching to the script-loader actually made it worse, because now it attempts to load the scripts from the first party host as well, and also trips over my :asset-path "/" config XD So when embedding