Fork me on GitHub

How can I run shadow watch app on my local IP instead of localhost? I want to test my app on mobile


@hoertlehner people have reported that this happens when the output files are on the classpath? did you upgrade the JDK version? that would explain the nashorn warning?


I did not update jvm. Nashorn warning now comes when shadow checks npm dependencies.


Output goes to target/we app/public.


@thheller Might this constant recompile issue happen also due to the bundle being in a resource path?


I don't have a clue whats causing this. otherwise I'd fix it.


it might be your editor


or some other watcher touching files


can't do much without a reproducible example


@somedude314 it should be available on your local IP automatically?


Ah you are right, thanks. I didn’t think that was the case because the console says “localhost”

Drew Verlee14:07:12

When i run shadow-cljs watch app s i get a warning about shadow cljs devtools not being able to locate refactor nrepl:

[2020-07-17 09:22:55.580 - WARNING] :shadow.cljs.devtools.server.nrepl/middleware-fail - {:sym refactor-nrepl.middleware/wrap-refactor}
FileNotFoundException Could not locate refactor_nrepl/middleware__init.class, refactor_nrepl/middleware.clj or refactor_nrepl/middleware.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
	clojure.lang.RT.load (
	clojure.lang.RT.load (
	clojure.core/load/fn--6839 (core.clj:6126)
	clojure.core/load (core.clj:6125)
	clojure.core/load (core.clj:6109)
	clojure.core/load-one (core.clj:5908)
	clojure.core/load-one (core.clj:5903)
	clojure.core/load-lib/fn--6780 (core.clj:5948)
	clojure.core/load-lib (core.clj:5947)
	clojure.core/load-lib (core.clj:5928)
	clojure.core/apply (core.clj:667)
	clojure.core/load-libs (core.clj:5985)
I'm not sure what to do. Should i be including refactor nrepl middlware? I can make a minimal project if that would help debug this. Many thanks on any hints.


you have configured that middleware somewhere. shadow-cljs does not use it. well maybe cider-nrepl or whatever configures it? I don't really know.


might be in your global config again?


all the default nrepl locations apply, not sure what they are exactly. I think .nrepl.edn in your project and somewhere else

Drew Verlee14:07:57

➜ Cabotage git:(master) ✗ cat ~/.nrepl/nrepl.edn {:middleware [refactor-nrepl.middleware/wrap-refactor]} Many thanks. This is likely it. i had no idea this existed. I must say, its sometimes overwhelming all the places dependencies can be set.


hmm yeah I couldn't decide whether I should adopt nrepl defaults or not

Karol Wójcik14:07:29

Is it possible for shadow-cljs to generate full externs file like that tool does?


no. why would it? that tool should never be used by anyone.

Karol Wójcik14:07:42

I would like to generate externs for react-jss to provide cljsjs.react-jss package as a backward compatibility for people who will not use the new :target :bundle option. Seems that the generator I've linked is unable to produce externs for Thought that maybe shadow-cljs is able to do it.


so you are using react-jss in your library?


ok then add extern inference hints in YOUR library


then react-jss doesn't need any externs at all


unless users of your library also use react-jss directly and don't use your stuff your library already uses.

😄 3
Karol Wójcik15:07:53

I would rather allow the users to consume react-jss directly


you can also write the more "modern" CLJSJS style. you are writing the bad old style.

Karol Wójcik15:07:37

Ok guide me master.

Karol Wójcik15:07:44

What the "modern" means?


no clue how it works exactly but you can configure :foreign-libs to "provide" react-jss


so (:require ["react-jss" :as x]) works regardless of using CLJSJS or shadow-cljs or bundle


so just use the react-jss require and alias instead of the global js/ alias


like reagent it doesn't use any js/ globals anymore because the compiler does that automatically when using cljsjs

Karol Wójcik16:07:58

Ok got it! You're right I can simply use ["react-jss" :as react-jss] and compatibility will be preserved.

Karol Wójcik16:07:57

It seems that I do not have to provide cljsjs.react-jss namespace as well. Am I right?


yes, thats not required

Karol Wójcik22:07:49

Thank you @thheller! You are awesome!

Drew Verlee20:07:44

I assume this warning means ill need to supply a type hint:

17 |                   (let [x @loadable]
  18 |                     (when-some [modules (.-modules loadable)]
Cannot infer target type in expression (. loadable -modules)
Will there be more then that?


I don't understand the question?

Drew Verlee20:07:10

Shadow is giving me a warning that it cannot infer the target type. My assumption is that i have to tell it the type, is that correct?


yes, that is an externs inference warning


if you don't wan't them you can turn the warnings off


I just turned them on by default recently

👏 3

:compiler-options {:infer-externs true} turns them off

Drew Verlee20:07:06

makes sense. ill think about if i want i need to do more later


it might compile fine without hints

Drew Verlee20:07:56 It says it should be true by default or i'm i reading that wrong


didn't update that


its now :infer-externs :auto by default

Drew Verlee20:07:14

awesome. as always thanks for the help @thheller

Felipe Marques23:07:32

I'm trying to write a build-hook that adds some preloads. The build-hook runs on the :configure stage and adds the preload like this:

(update-in build-state [:devtools :preloads] conj 'my.preload.namespace)
Is it possible to do this?