Fork me on GitHub
#shadow-cljs
<
2017-10-31
>
cmal03:10:02

Hi, I've got this warning in shadow-cljs release app:

-> Compile CLJS: devtools/hints.cljs
WARNING: You required cljs-devtools library in a project which is currently compiled with :optimizations :advanced.
         You should remove this library from non-dev builds completely because it impedes dead code elimination.
         The best way is to use :preloads compiler option: .
         To silence this warning please set :silence-optimizations-warning config key to true.
         More details: .
What should I add to the shadow-cljs.edn?

thheller07:10:01

@cmal not sure, maybe :compiler-options {:silence-optimizations-warning true}?

thheller07:10:25

or do you want it in dev only?

thheller07:10:41

then :devtools {:preloads [devtools.preload]}

cmal08:10:26

Thanks. If I already have :devtools {:preloads [re-frisk.preload] :autoload true} in shadow-cljs.edn, should I change it to :devtools {:preloads [[re-frisk.preload] [devtools.preload]] :autoload true}?

thheller08:10:58

:preloads [re-frisk.preload devtools.preload]

cmal08:10:14

Another question. I am doing shadow-cljs watch app and then shadow-cljs cljs-repl app but I got this in cljs-repl:

[1:1]~cljs.user=> (+ 1 1)
There is no connected JS runtime.

thheller08:10:42

yeah your app needs to be loaded in the browser or so

cmal08:10:52

OK. Thanks.

thheller08:10:52

if you just want a repl you can do shadow-cljs node-repl

mhuebert10:10:50

2.0.50 introduced this error when building maria:

[:live] Configuring build.
[:live] Build failure:
target-fn shadow.build.targets.browser/process not found
{:target :browser}
ExceptionInfo: target-fn shadow.build.targets.browser/process not found
	clojure.core/ex-info (core.clj:4744)
	clojure.core/ex-info (core.clj:4744)
	shadow.build/get-target-fn (build.clj:180)
	shadow.build/get-target-fn (build.clj:153)
	shadow.build/configure (build.clj:198)
	shadow.build/configure (build.clj:185)
	shadow.cljs.devtools.server.worker.impl/build-configure (impl.clj:121)
	shadow.cljs.devtools.server.worker.impl/build-configure (impl.clj:90)
	shadow.cljs.devtools.server.worker.impl/fn--22666 (impl.clj:208)
	shadow.cljs.devtools.server.worker.impl/fn--22666 (impl.clj:200)
	clojure.lang.MultiFn.invoke (MultiFn.java:233)
	shadow.cljs.devtools.server.util/server-thread/fn--22550/fn--22551/fn--22555 (util.clj:162)
	shadow.cljs.devtools.server.util/server-thread/fn--22550/fn--22551 (util.clj:161)
	shadow.cljs.devtools.server.util/server-thread/fn--22550 (util.clj:146)
	clojure.core.async/thread-call/fn--7892 (async.clj:442)
	java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142)
	java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
	java.lang.Thread.run (Thread.java:745)

thheller10:10:07

that definitely exists

thheller10:10:57

may be bad AOT cache, try deleting target/shadow-cljs/aot-classes

thheller10:10:37

wonder how it got into that state

thheller10:10:05

wonder how the other thing happened though

thheller10:10:42

21023 events is that normal in the shadow-re-frame demo?

thheller10:10:58

its firing events like crazy?

thheller10:10:49

guess it calling render for every time it wants to update the counter

thheller10:10:02

by doing so triggering another render?

thheller10:10:21

can’t tell if that might be related due to an update I did?

mhuebert10:10:14

no, that’s not normal

mhuebert10:10:31

but i know what the cause would be

thheller11:10:04

so not something I may have just caused by the update?

mhuebert11:10:42

I don’t think so. it is related to how component-paths are read

mhuebert11:10:19

i had fixed it, but recently my patch was merged into re-frame-trace and one aspect of it may have not been applied/merged correctly

thheller11:10:11

good to know. I was getting worried that my update didn’t work properly

mhuebert11:10:19

i will build with latest update now

mhuebert11:10:21

to make sure

mhuebert11:10:52

and then test my other project with that bug from yesterday

mhuebert11:10:35

not important but WARNING: You required cljs-devtools library in a project which is currently compiled with :optimizations :whitespace.

mhuebert11:10:58

shouldn’t this warning only occur on :release?

thheller11:10:55

hmm its by cljs-devtools not by me

thheller11:10:29

hmm ok it checks :optimizations which it expects to be :none

thheller11:10:44

I guess I can set that so it doesn’t complain

thheller11:10:04

in shadow-cljs :optimizations is only used in release mode and otherwise ignored

mhuebert11:10:44

i wouldn’t worry about it

mhuebert11:10:05

this project is a special case / demo of dev-time tools

mhuebert11:10:33

i just pushed an update to shadow-re-frame, for me the events count normally

thheller11:10:47

you could also set :release {:compiler-options {:optimizations :whitespace}} which would only set that option for release

thheller11:10:29

but I will still force it to :none since other macros might use that as well

thheller11:10:44

not something I ever recommend doing but people do weird things

mhuebert11:10:37

yeah the fix from yesterday looks like it works

thheller11:10:24

counter still going crazy for me

mhuebert11:10:58

on the deployed version or locally?

mhuebert11:10:06

& which browser?

thheller11:10:27

no deployed version is fine, just my local version

thheller11:10:43

:source-paths ["src"

                ;; for development, checkout re-frame-trace and re-view into sibling directory,
                ;; or remove these entries:
                "../re-frame-trace/src"
                "../re-view/re-frame-simple/src"]

thheller11:10:52

I might have old checkouts of those

mhuebert11:10:12

maybe remove those dirs

mhuebert11:10:18

use the version from clojars

thheller11:10:48

yeah thats it

thheller11:10:48

:whitespace warning should also be gone in next update

mhuebert11:10:11

extern annotation with ^js is pretty easy and intuitive

mhuebert15:10:31

still getting this browser/process not found error after rm -rf target

mhuebert15:10:16

it does not happen if I compile the :live build by itself, only when multiple builds at the same time

mhuebert15:10:58

and it is order dependent, npx shadow-cljs watch trusted live fails, npx shadow-cljs watch live trusted works

mhuebert16:10:48

downside to loading bootstrap stuff via inline <script> tags is that errors show up as coming from <anonymous> locations:

TypeError: Cannot read property 'cljs$core$IFn$_invoke$arity$1' of undefined
    at Function.cljs.spec.test.alpha$macros.instrument.cljs$core$IFn$_invoke$arity$4 (<anonymous>:248:95)
    at Function.cljs.core.apply_to_simple.cljs$core$IFn$_invoke$arity$6 (/js/compiled/cljs-runtime/cljs.core.js:13067:10)

thheller21:10:34

@mhuebert you keep finding the good bugs. npx shadow-cljs watch trusted live should now work in [email protected]

thheller21:10:15

race condition when loading the target fn, so two builds with the same :target would cause one to fail.

mhuebert22:10:16

i’m trying to get a circleci thing running for maria

mhuebert22:10:40

if i can figure this config out, it would be nice to get it to run whenever shadow-cljs updates 🙂