Fork me on GitHub

@thheller after I bumped I'm getting a ton of these:


[:failed-to-compare "^2.2.5" "2.2.6" #error {
 :cause nil
 [{:type java.lang.NullPointerException
   :message nil
   :at [shadow.cljs.devtools.server.npm_deps$make_engine invokeStatic "npm_deps.clj" 20]}]
 [[shadow.cljs.devtools.server.npm_deps$make_engine invokeStatic "npm_deps.clj" 20]
  [shadow.cljs.devtools.server.npm_deps$make_engine invoke "npm_deps.clj" 11]
  [shadow.cljs.devtools.server.npm_deps$fn__18305$fn__18306 invoke "npm_deps.clj" 27]
  [clojure.lang.Delay deref "" 42]
  [clojure.core$deref invokeStatic "core.clj" 2312]
  [clojure.core$deref invoke "core.clj" 2298]
  [shadow.cljs.devtools.server.npm_deps$fn__18305$fn__18308 invoke "npm_deps.clj" 33]
  [shadow.cljs.devtools.server.npm_deps$is_installed_QMARK_ invokeStatic "npm_deps.clj" 163]
  [shadow.cljs.devtools.server.npm_deps$is_installed_QMARK_ invoke "npm_deps.clj" 157]
  [shadow.cljs.devtools.server.npm_deps$main$fn__18389 invoke "npm_deps.clj" 179]
  [clojure.core$complement$fn__5391 invoke "core.clj" 1433]
  [clojure.core$filter$fn__5614 invoke "core.clj" 2813]
  [clojure.lang.LazySeq sval "" 40]
  [clojure.lang.LazySeq seq "" 49]
  [clojure.lang.RT seq "" 528]
  [clojure.core$seq__5124 invokeStatic "core.clj" 137]
  [clojure.core$seq__5124 invoke "core.clj" 137]
  [shadow.cljs.devtools.server.npm_deps$main invokeStatic "npm_deps.clj" 181]
  [shadow.cljs.devtools.server.npm_deps$main invoke "npm_deps.clj" 172]
  [shadow.cljs.devtools.cli$main invokeStatic "cli.clj" 162]
  [shadow.cljs.devtools.cli$main doInvoke "cli.clj" 153]
  [clojure.lang.RestFn applyTo "" 137]


the compilation still works, but that's making the console unusable


@wilkerlucio hmm odd. should be fixed in 2.6.12


I've been reading but cannot figure out a way to require the go macro from cljs.core.async


I get

File: jar:file:/home/hukka/.m2/repository/thheller/shadow-cljs/2.4.21/shadow-cljs-2.4.21.jar!/shadow/cljs/devtools/client/hud.cljs:1:1

   1 | (ns shadow.cljs.devtools.client.hud
Invalid :refer, var cljs.core.async/go does not exist
   2 |   (:require
   3 |     [shadow.dom :as dom]
   4 |     [shadow.xhr :as xhr]
   5 |     [shadow.animate :as anim]
no matter what kind of requires I use in my code


@tomi.hukkalainen_slac you have an old incompatible core.async version in your classpath


Hum, ok. No wonder I'm hitting walls


make sure its 0.4.474


cljs-http requires 0.3.442 😞 Let's see if it works with overrides


Huh. The maintainer has made a release on the same day, before he updated the deps


yeah that dep should really be bumped


I hadn't realized that <!! is not available on cljs, so I couldn't do the quick hack I needed anyway 😞 But thanks again for the lightning fast help. I wouldn't have guessed the problem from that error and my googling wasn't good enough


yes blocking IO is not possible in CLJS (or rather the underlying JS)


@thheller fix confirmed, thanks!


If I 1. start MY_ENV=foo shadow-cljs server, 2. connect via nrepl and compile a node-script build, 3. start the script with MY_ENV=bar node out/my-script.js, 4. connect a node-repl, then (.-MY_ENV js/process.env) has the value foo. How come? I’d expect bar.


are you connecting to node-repl or the REPL for your build?


node-repl is its own node process started by shadow-cljs


I have an :npm-module project that's being yarn installed from a git repo by a website, and so runs shadow-cljs release npm in the package.json postinstall hook. Unfortunately the module uses Reagent, which needs (but doesn't explicitly depend on) other packages, so shadow-cljs apparently doesn't have some namespaces (for example, create-react-class) available at this point. The dependencies are installed by yarn, but in the main website's node_modules, which I guess isn't accessible to each individual package's postinstall command. Are there any good/recommended ways of making such packages available when the project is installed as a dependency?


I'm currently looking at ways to just distribute the transpiled javascript instead, but I might just be missing something, so advice is welcome.


Hi. Is there a way to get the access to the data from shadow-cljs.edn in my cljs files?


@mel.collins never use shadow-cljs in a postinstall hook, thats just way too slow. instead you do the release and just publish the compiled files instead


@p-himik only in the form of :closure-defines. what else would you want access to?


@thheller E.g. TinyMCE has an option to explicitly provide it with the paths to themes and skins that it downloads when it's used for the first time.


So, I think :asset-path is required in this case.


not sure what you'd want to do with that? it only contains the files generated by the compiler


Maybe my logic is a bit convoluted, yeah. Right now, I use a build hook to copy all relevant files from node_modules to :asset-path, and then use the copied files either as arguments to TinyMCE or somewhere in index.html (e.g. CSS files).


(meaning that the themes and skins won't be on that directory)


ah so they are there


so :asset-path is available as js/CLOSURE_BASE_PATH


but its a development only thing so do not use that


its probably best to goog-define it


OR just discover it dynamically by looking for the script tag in the DOM and taking its src attribute


Wow that's convoluted.


Would it make sense to add an access to shadow-cljs.edn via some marco that just inlines all requested values?


hmm no I don't think so


but I still don't understand what exactly it is you are trying to do


you already copied the files yourself. assume for a second that you copied them somewhere NOT in :asset-path


how would you pass it then?


I would have to write this other path in: 1. Some cljs files that use them (currently an issue with :asset-path as well) 2. In index.html (not an issue with :asset-path since the server can just read the EDN and inline all values in the HTML template) 3. In nginx.conf (not an issue since this file is being generated from different files, including the EDN) Of course, for (1) I could use the same thing as in (2) or (3), but it would become much more convoluted than it is now, and also it would probably lose some integration with IDE since I would have to use some kind of templating. Another solution would be to read the EDN with some Lein plugin (I also use project.clj). I think something like that can be achieved since there's already lein-environ plugin that does something similar.


so I do have plans for adding support for some static asset paths


say in webpack you can require("./some-path/some.png") and it'll return the path to that file


it sounds like that is what you need


so (def some-tiny-mce-asset (assets/path-for "tiny-mce/theme/foo.css"))?


or is it just a bunch of files with a specific naming convention where the entire folder needs to be copied?


the compiler would only copy the path you actually asked for but could maybe support wildcards


the problem with having a macro access the config is cache invalidation since the code must be recompiled if the values change


and that already is complicated enough. I don't want to add to it


It's both. CSS are used in just the way you described, with require. That is, in JS. In CLJS, I just include the relevant CSS files in index.html and copy them from node_modules/something to :asset-path. And some things, like TinyMCE require a user to supply a bunch of files with a specific naming convention. So in this case, I just copy the whole folder from node_modules/tinymce to :asset-path and then pass the configured path (mapped in nginx.conf) to tinymce.init. > the problem with having a macro access the config is cache invalidation since the code must be recompiled if the values change Ahhh, that's right. I remember having this issue with lein-environ. Thanks for making me aware of that. Would the option with goog-define that you've suggested solve it? If so, could you please describe it a bit more? I have no clue on how one would link it with shadow-cljs.edn.


you don't "link" it. you create (ns your.config) (goog-define asset-path "/foo") and in the config :closure-defines {your.config/asset-path "/bar"}


a helper function might help too (defn path-for [asset] (str asset-path asset))


so you use (config/path-for "/some.css") in your code


Ah, so I will have to repeat the value of :asset-path - in :asset-path itself and in :closure-defines?


technically :asset-path itself has no meaning in release builds


since you decide what the asset path is when you include the <script src="/something/foo.js">


development builds just need to know the path since they dynamically load more code later (eg. hot-reload)


but yeah you would add it twice


I see. Thanks!


@thheller upgraded to 2.6.12 and randomly got an exception and now seems stuck/hanging:


given that it is in a boot function I have no idea whats happening


The HUD seems to regularly malfunction on me when I’m working with errors like this:

#error {:message 
"Invalid symbol: cloj … lang.ExceptionInfo:."
, :data {:type :reader-exception, :ex-kind :reader-error}}
shadow$cljs$devtools$client$env$process_ws_msg	@	env.cljs:151
(anonymous)	@	browser.cljs:343


I’ve been seeing this for some time. sometimes HUD works, but often it just spins and I have to look in the console to understand the error


Seems like the serialization n line 104 of impl.clj is sending an exception over the websocket, and cljs reader can’t decode it because it is a clojure type


not sure why it works sometimes, and sometimes not