This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-19
Channels
- # adventofcode (1)
- # announcements (3)
- # babashka (60)
- # beginners (60)
- # calva (5)
- # clj-commons (17)
- # clj-kondo (33)
- # clj-on-windows (1)
- # clojure (40)
- # clojure-austin (3)
- # clojure-europe (19)
- # clojure-gamedev (25)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-sweden (4)
- # clojure-uk (2)
- # clojurescript (27)
- # conjure (1)
- # core-async (1)
- # core-typed (7)
- # cursive (5)
- # datomic (35)
- # events (1)
- # fulcro (35)
- # integrant (7)
- # introduce-yourself (2)
- # kaocha (5)
- # leiningen (2)
- # lsp (26)
- # malli (13)
- # nbb (99)
- # off-topic (15)
- # pathom (12)
- # pedestal (5)
- # polylith (8)
- # portal (4)
- # rdf (19)
- # reagent (8)
- # reitit (5)
- # releases (2)
- # remote-jobs (2)
- # rewrite-clj (1)
- # shadow-cljs (94)
- # testing (2)
- # timbre (2)
- # tools-deps (16)
no goog/base.js
{}
ExceptionInfo: no goog/base.js
shadow.build.output/closure-defines-and-base (output.clj:58)
shadow.build.output/closure-defines-and-base (output.clj:53)
shadow.build.targets.graaljs/flush-dev (graaljs.clj:127)
shadow.build.targets.graaljs/flush-dev (graaljs.clj:111)
shadow.build.targets.graaljs/process (graaljs.clj:168)
shadow.build.targets.graaljs/process (graaljs.clj:160)
clojure.lang.Var.invoke (Var.java:384)
shadow.build/process-stage/fn--26795 (build.clj:161)
shadow.build/process-stage (build.clj:158)
shadow.build/process-stage (build.clj:150)
shadow.build/flush (build.clj:494)
shadow.build/flush (build.clj:488)
shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:364)
shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:344)
shadow.cljs.devtools.server.worker.impl/do-config-watch (impl.clj:563)
shadow.cljs.devtools.server.worker.impl/do-config-watch (impl.clj:556)
shadow.cljs.devtools.server.util/server-thread/fn--28186/fn--28187/fn--28195 (util.clj:269)
shadow.cljs.devtools.server.util/server-thread/fn--28186/fn--28187 (util.clj:268)
shadow.cljs.devtools.server.util/server-thread/fn--28186 (util.clj:241)
java.lang.Thread.run (Thread.java:833)
any custom build-hooks by chance? IIRC this could happen if a build hook doesn't return the proper build state?
dunno what else then. this is fairly standard code touched by multiple targets (and working fine for me locally)
anything else look wrong in the config?
{:deps {:aliases [:sci]}
:dev-http {7778 {:roots ["public" "classpath:public"]}}
:nrepl false
:builds {:browser {:target :graaljs
:output-to "public/js/viewer.js"
:output-dir "public/js"
:build-options {:ns-aliases {nextjournal.devcards nextjournal.devcards-noop}}
:modules {:viewer {:entries [nextjournal.clerk.sci-viewer
nextjournal.clerk.static-app]}}
:dev {:compiler-options {:optimizations :simple}}
:release {:output-dir "build/"
:compiler-options {:source-map true}}
:js-options {:output-feature-set :es8}}}}
:dev {:compiler-options {:optimizations :simple}}
does absolutely nothing since dev never does any optimizations at all
since optimizations are not applied in dev regardless of what you set, you can just put it in normally
so just :compiler-options {:optimizations :simple}
without nesting in :dev
/`:release`
tiny thing I noticed, should :graaljs
be added to this list?
Target ":node" for build :browser was not found. The built-in targets are:
- :browser
- :browser-test
- :node-script
- :node-library
- :npm-module
- :karma
- :bootstrap
things can access the same memory, so pretty sure passing a map can be implemented if you'd like to avoid going through json
then you end up with "proxies" and not real maps. at which point it would be better to serialize transit back/forth to get actual real maps
and if one performs better than the other depends on if you'll need all data in the map or just parts
I'm creating a node-library target with two build targets, one for app and one for test. Test target has :autorun true
set and has worked well when I execute npx shadow-cljs compile test
the tests run fine. Some new code I'm testing relies heavily on promises and I'm using https://github.com/funcool/promesa in my library and test code. Test assertions inside a promesa.core/let aren't run. I tried moving the deftest inside a promesa.core/let but that hasn't worked either and the test count went down, leading me to believe that the test runner has completely lost sight of the suite. Have I missed something or should tests with promises be conducted in a special way?
In the shadow-cljs user guide promises are only mentioned twice. Nothing in connection with testing.
do you use clojure.test/async correctly? async tests need to be marked as such. otherwise the runner won't know about them and won't wait for their completion
ah, pretty sure I'm not since I haven't met clojure.test/async. Going to investigate now.
Made the necessary changes and my assertions are running. Thanks for the pointer! 🙂
Two questions about module splitting / dynamic loading:
1. Is this sort of the intended usage for shadow.loader
?
(ns example.core
(:require [shadow.loader :as loader]))
(defn load-ui! []
(-> (loader/load "ui")
(.then #(example.other/mount-root))))
(defn ^:export ^:dev/after-load init []
(load-ui!))
where I'm using example.other/mount-root
as it I had :require
d it at the top level? It seems to work, just making sure that's the intention. (and if so -- any editor sympathetic tips for autocomplete, etc?)
2. I'm trying to figure out what the hell an ESM environment is, e.g., https://shadow-cljs.github.io/docs/UsersGuide.html#target-esm, so that I can use this sweet trick: https://shadow-cljs.github.io/docs/UsersGuide.html#_dynamic_module_import. But when I do
(shadow.esm/dynamic-import anything)
I get shadow_esm_import is not defined
1) no this is not the intended use case. loading a module directly on startup is worse than having the code part of the "base" module directly
yeah I get that. I meant syntactically/mechanically -- once the .then
in the promise triggers, the namespace is now available to be used as if it were :require
d? I agree it's not the smartest way to split code.
https://code.thheller.com/blog/shadow-cljs/2019/03/03/code-splitting-clojurescript.html
https://clojureverse.org/t/shadow-lazy-convenience-wrapper-for-shadow-loader-cljs-loader/3841
Interesting. You're not using shadow.loader
at all in that example
because its API is annoying to use and just a direct mirror of cljs.loader
for compatibility reasons
I thought it was pretty good!!
2) ESM is ecmascript modules, a modern variant of JS. shadow.esm only works in :target :esm
builds, not in :target :browser
Okay #3: When splitting code across modules, any insight into how state is shared? For instance, let's imagine
(ns example.db
(:require [reagent.core :as reagent]))
(defonce app-db (reagent/atom {:data 0}))
(ns example.a
(:require shadow.loader))
(-> (shadow.loader/load "db") (.then #(swap! example.db/app-db update :data inc)))
(ns example.b
(:require shadow.loader))
(-> (shadow.loader/load "db") (.then #(swap! example.db/app-db update :data inc)))
(ns example.ui
(:require [example.db :as db]
reagent.ratom))
(defn show-me []
(let [number (reagent.ratom/make-reaction #(get @db/app-db :data))]
(fn []
[:div (str "Your number is: " @number)])))
I'm trying to imagine if show-me
, when rendered, would show 0, 1, or 2 as the numberassuming that a and b were loaded and run
Ok. So if I'm not mistaken that implies that that modules do not share state, and that state would need to be communicated through modules via some other method, almost as if there were independent workers
everything runs in the same "scope". so they share all memory and are NOT independent such as workers
Ok. I guess I'm trying to figure out a pattern for making things such as a reagent/atom app-db
and possible derived reagent.ratom/make-reactions
separate from things like the UI and application logic. And I'm struggling to understand how, for instance, if the DB, the make-reactions
, the UI, and the domain logic were all in separate modules, how could an on-click on one of the UI components update the app-db state if it were in a separate module -- and then how would the make-reactions
pick up the reactive changes from the app-db
, and then how would that get communicated back to the UI components. Maybe tl;dr I'm trying to figure out what sort of things MUST be directly coupled and which things can be indirect.
I really cannot explain or add to what I linked in https://code.thheller.com/blog/shadow-cljs/2019/03/03/code-splitting-clojurescript.html
Wow, that is a real eye-opener. I am always late to the party, in this case thinking only about massive CPUs and GPUs running Web browsers vs mobile. When mobile is taking over the world! Plz help a dummy: is this another argument for the Flutter/Dart platform, because it eschews JS? Or should those apps likewise sweat over chopping up functionality so it loads JIT? :thinking_face:
apps don't really have the issue of trying to keep code size small, so its entirely different area
Haha ok my bad, I'll just go off of that
Sorry for all the q's, just really excited about all the new possibilities
I've been writing massive monolithic apps forever
the reagent atom parts do not change at all and won't be aware of module loading in any way
the only part that changes is that something triggers the lazy load of some code on click or whatever
cool, yeah that makes sense (and keeps things easy)
https://github.com/thheller/code-splitting-clojurescript/blob/master/src/main/demo/env.cljs#L4
Oh nice!!
Hi everyone! I’m getting this error trying to use heroicons v2
Dependency: @heroicons/react/24/outline not provided by external JS. Do you maybe need a recompile?
Any ideas?looks like you are using :js-provider :external
. did you recompile the :external-index
file with whatever tool you use? (webpack?)
did you add the dependency to package.json? and installed it..