Fork me on GitHub
#shadow-cljs
<
2018-11-27
>
heyarne01:11:49

i have a reagent view that i use for debugging. it lives in its own namespace and basically just looks like this: (defn debug [x] [:pre (with-out-str (pprint data))])

heyarne01:11:03

it's required nowhere but still pprint ends up in the bundle

heyarne01:11:39

can i help google closure compiler with identifying this as unused code?

thheller01:11:43

cljs.pprint can not currently be removed by closure

thheller01:11:32

so cljs.pprint itself is the problem and remains as soon as you import it

thheller01:11:36

even if unused

heyarne01:11:55

i see. so i could try switching to zprint i guess?

thheller01:11:16

they'll pretty much all remain in some form

thheller01:11:38

closure doesn't remove defmulti/defmethod so as soon as that is used you are out of luck

thheller01:11:51

I think fipp was decently removeable

thheller01:11:02

best to remove the code completely by not importing it in the first place 😉

heyarne01:11:20

oh nice. yeah i just switched to fipp which shaved off 108kb (pre-gzip) off my build

heyarne01:11:45

i'm always amazed by how quick i get answers here. thanks for all the support!

heyarne01:11:58

shadow-cljs is amazing

❤️ 1
ClashTheBunny02:11:48

It steals your cryptocurrency wallet.

thheller08:11:43

yeah .. what else ... 😉

thheller08:11:06

> he emailed me and said he wanted to maintain the module, so I gave it to him. I don't get any thing from maintaining this module, and I don't even use it anymore, and havn't for years.

thheller08:11:16

just lol ...

thheller09:11:13

time to rethink this container business I guess 😉

achikin11:11:32

I made a small demo of adding npm dependency to a running watch build.

jcb13:11:57

I know this must have come up before, but I can't find a definitive answer. I've been using https://github.com/thheller/lumifoo as a guide to integrate shadow-cljs into a luminus project. However every time the watch socket updates the browser I get a an error "Target container is not a dom element" - what do I need to change to remedy this? thanks! - to clarify I'm just running this repo for testing with a couple of non-breaking dependency bumps and npm for react/dom etc

thheller14:11:26

@jcb that error is from react when the element does not exist

thheller14:11:44

so there is no #navbar or #app in the HTML maybe?

thheller14:11:37

can really remember what that repo was about

thheller14:11:48

just check if the HTML matches what the code expects

jcb14:11:53

hi thanks for the example repo, I checked before asking and it's all fine. I think it might have something to do with the way the history is working with the page routing. I'll probably just move on and try to adapt a more recent version of the luminus template and see how I go. cheers!

jcb15:11:11

actually, is there any other full stack frameworks that you could suggest that work well with shadow-cljs?

jcb15:11:14

I don't program full time, just occasionally as a tool for work, so I can't really try everything out. I've used luminus as it has has good documentation and covers all the bases with sensible defaults but I'd be open to changing things up.

thheller15:11:48

fulcro is nice

🎉 4
jcb15:11:06

thanks, i did give it a go a while back but it wasn't quite so easy to get into. Also om next seemed quite daunting compared to reagent

jcb15:11:26

perhaps now that I've made a couple of things it might make more sense

jcb15:11:36

http://book.fulcrologic.com <---- I'm pretty sure this didn't exist back then. looks great

mj_langford16:11:27

Crytpocurrency finally made malware stop trying to steal WoW account credentials.

eoliphant17:11:53

hey guys, I ran into an issue, where I was trying to use a local version of an npm lib, that was installed via npm install <pkg dir>. During the release build it throws a “ExceptionInfo: files outside the project are not allowed: ” Have the same issue if you try an npm link

eoliphant17:11:16

yeah @jcb Fulcro is a bit more to get into up front, especially compared to say reagent, etc. But, I’ve found more than once, that by the time you get done pulling in other libs, and creating some of your own utilities, etc etc you end up with a good subset of what Fulcro gives you out of the box.

wilkerlucio17:11:12

also fulcro tooling has been evolving a lot lately, that's a big thing to do if you are trying to make your own stuff, IMO (disclaimer: I wrote some of those) Fulcro has top grade tools for web development (db inspector, transaction log, network log, query running built-in, tracer if used with pathom...)

1
thheller17:11:58

@eoliphant symlinks or npm link should be allowed depending on the version you are on. forgot which version I add that though, might need to upgrade?

eoliphant18:11:43

ok, looks like 2.4.22 will upgrade and give it a whirl

eoliphant18:11:01

just went to 2.7.6 and still seeing the same thing 😞

achikin21:11:36

From the docs (:require ["module-name" :refer (export)]) - why does :refer block is not in square brackets as usual?

thheller22:11:47

@achikin it doesn't matter. use what you prefer. I prefer a list for :refer. vector or even sets are fine too

👍 1
thheller22:11:33

@eoliphant are you sure its linked properly and wasn't installed nested somewhere

thheller22:11:47

node_modules/foo -> ../../whatever/foo?

eoliphant22:11:38

I think so. But will check it again when I get home

richiardiandrea23:11:56

so I have a failure in my release functions:

[2018-11-27T23:26:20.408Z]  INFO: scrutinize-event-fn/10976 on RD28187871EEEA: interceptor error (function=scrutinize-event-fn, :namespace=cljs.user, :level=info, retry-counter=0, trace-id=3
aa0f630-2610-4cb4-9f51-8000fda9a3b8, error={})
    Error: [object Object] is not ISeqable
        at Object.cljs.core.seq (D:\home\site\wwwroot\cljs\shared.js:6731:9)
        at Function.cljs.core.seq_reduce.cljs$core$IFn$_invoke$arity$3 (D:\home\site\wwwroot\cljs\shared.js:8386:25)
        at Function.cljs.core.reduce.cljs$core$IFn$_invoke$arity$3 (D:\home\site\wwwroot\cljs\shared.js:8463:136)
        at Object.cljs.core.vec (D:\home\site\wwwroot\cljs\shared.js:15652:235)
        at Function.cljs.core.async.map.cljs$core$IFn$_invoke$arity$3 (D:\home\site\wwwroot\cljs\shared.js:59880:19)
        at Function.cljs.core.async.map.cljs$core$IFn$_invoke$arity$2 (D:\home\site\wwwroot\cljs\shared.js:59877:30)
        at Object.laputa.scrutinize_fn.fx.command_commit_event_BANG_ (D:\home\site\wwwroot\cljs\shared.js:65920:120)
        at laputa.scrutinize_fn.interceptor.commit_event_BANG_ (D:\home\site\wwwroot\cljs\shared.js:66027:34)
        at Object.sieppari.core.try_f (D:\home\site\wwwroot\cljs\shared.js:55118:89)
        at sieppari.core.leave (D:\home\site\wwwroot\cljs\shared.js:55133:202)
I was wondering how can I see the source mapped version with release?

thheller23:11:39

shadow-cljs release the-build --source-maps

thheller23:11:45

or shadow-cljs release the-build --debug (for source maps + pseudo-names)

thheller23:11:25

laputa.scrutinize_fn.fx.command_commit_event_BANG_ guess you are running :simple?

richiardiandrea00:11:17

yep I am running simple at the moment, I did not know I needed a switch, I do have :source-maps true

thheller00:11:22

its :source-map true I think

thheller00:11:36

can never remember if its source-map or source-maps

richiardiandrea00:11:50

yep I have:

:release {:compiler-options {:optimizations :simple
                                              :variable-renaming :off
                                              :property-renaming :off
                                              :pretty-print true
                                              :source-map true}
                           :autorun false}

richiardiandrea00:11:37

I will double check if source-map-support is in the deployed node_modules together with the .map

thheller00:11:08

ah yeah you need to set that up manually

thheller00:11:16

its only loaded in dev by default

thheller00:11:53

node -r source-map-support your-script.js or however that works

richiardiandrea00:11:58

may I ask why? the vanilla compiler does that IIRC, is there any performance impact?

richiardiandrea00:11:18

yeah well I am not in control of what is passed to node

thheller00:11:38

dunno if its injected by default. I don't use node much.

thheller00:11:55

node -r source-map-support/register compiled.js

richiardiandrea00:11:01

it seems like it is required, I can add it manually for sure - maybe I can open an issue and actually contribute it

thheller00:11:46

thats the dev build

richiardiandrea00:11:13

right, for a second I remembered differently

lilactown23:11:37

I have a build like so:

:browser-tests {:target :browser-test
                          :test-dir "target/browser-tests/"
                          :module-loader true
                          :ns-regexp "-test"
                          :runner-ns runner.core
                          :devtools  {:http-port 8021
                                      :http-root "target/browser-tests/"}}
for some reason, this works perfectly fine on my computer but not on my coworkers. I'm using macOS and she is using Windows, though I don't think that's the issue

lilactown23:11:02

in her file system, I see the test.js built correctly, however it responds with a 404 from the shadow-cljs HTTP server

thheller23:11:02

remove the trailing slash from :http-root

thheller23:11:07

windows is picky like that

thheller23:11:19

also :test-dir

lilactown23:11:15

hmm that hasn't seemed to fix it