This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-24
Channels
- # announcements (1)
- # aws (2)
- # beginners (147)
- # boot (19)
- # cider (57)
- # clara (52)
- # cljdoc (18)
- # cljs-dev (14)
- # cljsrn (4)
- # clojure (176)
- # clojure-conj (9)
- # clojure-dev (9)
- # clojure-germany (2)
- # clojure-italy (4)
- # clojure-spec (13)
- # clojure-uk (56)
- # clojurescript (72)
- # code-reviews (11)
- # cursive (17)
- # data-science (1)
- # datomic (52)
- # duct (26)
- # emacs (6)
- # events (9)
- # figwheel (1)
- # figwheel-main (21)
- # fulcro (132)
- # funcool (1)
- # graphql (3)
- # jobs-discuss (42)
- # leiningen (3)
- # luminus (45)
- # mount (10)
- # off-topic (2)
- # re-frame (17)
- # reagent (12)
- # reitit (20)
- # ring-swagger (7)
- # rum (3)
- # shadow-cljs (256)
- # slack-help (15)
- # sql (7)
- # tools-deps (50)
- # uncomplicate (1)
- # yada (9)
I am noticing weird things too when reloading and I thought it was on my code base. I will try to repro after the update
is there a way to use node_modules
that are npm link
ed? It seems shadow-cljs doesn't pick them up.
@thheller getting this error
The required namespace "konserve.filestore" is not available, it was required by "infinitor/collector/database.cljs".
"konserve/filestore.clj" was found on the classpath. Should this be a .cljs file?
Looking in the repo for konserve they have one .clj file and one .cljs file. Is this a bug in shadow-cljs or should I look elsewhere?@emil0r looking at the repo isn't always the correct answer. looking at the .jar
is. and that doesn't include the filestore.cljs
. looks like that was created after the last release.
@bbss how so? it should be working as long as node_modules/the-thing/...
exists. the-thing
is allowed to be a link. maybe need to upgrade if you get a complaint about not being allowed to use sources outside the project. that was fixed.
I'm seeing linear growth in compilation times:
[:main] Build completed. (1197 files, 3 compiled, 0 warnings, 1.62s)
------ WARNING #1 --------------------------------------------------------------
point_cloud_layer_fragment_glsl assigned a value more than once.
--------------------------------------------------------------------------------
[:main] Build completed. (1197 files, 3 compiled, 0 warnings, 2.72s)
[:main] Build completed. (1197 files, 3 compiled, 0 warnings, 3.80s)
[:main] Build completed. (1197 files, 3 compiled, 0 warnings, 6.44s)
[:main] Build completed. (1197 files, 3 compiled, 0 warnings, 12.04s)
[:main] Build completed. (1197 files, 3 compiled, 0 warnings, 23.20s)
[:main] Build completed. (1197 files, 3 compiled, 0 warnings, 57.57s)
;;after shadow-cljs restart
[:main] Build completed. (1197 files, 1040 compiled, 0 warnings, 112.28s)
the cache issue where compiles got slower over time was fixed in 2.4.20
so must be something else
where? the point of the log is to first log when something starts and then again when something completes
please check how large .shadow-cljs/builds/main/dev/shadow-js/index.json.transit
is?
-rw-r--r-- 1 baruchberger staff 155600 Oct 24 22:35 .shadow-cljs/builds/main/dev/shadow-js/index.json.transit -rw-r--r-- 1 baruchberger staff 298854289 Oct 24 22:55 .shadow-cljs/builds/main/dev/closure-js/index.json.transit
-rw-r--r-- 1 baruchberger staff 298854289 Oct 24 22:55 index.json.transit
-rw-r--r-- 1 baruchberger staff 3958 Oct 24 19:43 module$gsv$api$partition.js
-rw-r--r-- 1 baruchberger staff 20392 Oct 24 22:53 module$gsv$ui$custom_point_cloud.js
-rw-r--r-- 1 baruchberger staff 5023 Oct 24 19:43 module$gsv$ui$point_cloud_layer_fragment_glsl.js
-rw-r--r-- 1 baruchberger staff 7160 Oct 24 19:43 module$gsv$ui$point_cloud_layer_vertex_glsl.js
the only thing I can imagine somehow, this morning I tried to use shadow-cljs to build a npm package, on a different project, it npm pack
s the directory (100mb) in the process.
I've pulled the latest into my shadow-cljs repo, but what was the command to install it locally again?
I have a local repl because earlier you pushed a fix for something and I wanted to have it quick.
just observe the cache index on each compile. it should be almost constant in size depending on the amount of JS files used
-rw-r--r-- 1 baruchberger staff 10699 Oct 24 23:21 start.index.json.transit
->
-rw-r--r-- 1 baruchberger staff 26659 Oct 24 23:27 index.json.transit
Enough of a growth increase? or is this expected?the index is basically just a map that tracks whatever compiler settings were active and so on
:injected-libs ("es6/util/inherits"
"es6/util/setprototypeof"
"util/objectcreate"
"es6/util/arrayfromiterable"
"es6/util/arrayfromiterator"
"es6/util/makeiterator"
"es6/symbol"
"es6/object/assign"
"util/polyfill"
"util/global"
"util/defineproperty"
but it ends up as a list. so it basically doubles in size on each compile since it re-adds everything
dev> (clojure.set/union #{1 2 3} '(1 2 3))
#{1 3 2}
dev> (clojure.set/union #{1 2 3} '(1 2 3 4))
(2 3 1 1 2 3 4)
dev> (source clojure.set/union)
(defn union
"Return a set that is the union of the input sets"
{:added "1.0"}
([] #{})
([s1] s1)
([s1 s2]
(if (< (count s1) (count s2))
(reduce conj s2 s1)
(reduce conj s1 s2)))
([s1 s2 & sets]
(let [bubbled-sets (bubble-max-key count (conj sets s2 s1))]
(reduce into (first bubbled-sets) (rest bubbled-sets)))))
Hmm, I see the implementation is very elegant. But a few warnings on non-sets would be nice.
I'm having trouble mapping react
to preact-compat
when targeting :npm-module
to build the leaves (view components) of an existing JS preact app in CLJS. Would you all expect this to work for my shadow-cljs.edn
?
{:source-paths ["src"]
:dependencies [[cljs-css-modules "0.2.1"]
[reagent "0.8.1"]]
:builds {:npm {:target :npm-module
:output-dir "build/cljs"
:compiler-options {:infer-externs :auto}
:js-options {:resolve {"react" {:target :npm
:require "preact-compat"}
"react-dom" {:target :npm
:require "preact-compat"}}}}}}
When I npx shadow-cljs compile npm
I get
[:npm] Build failure:
The required namespace "react" is not available, it was required by "reagent/core.cljs".
The only way I've found to move forward is to create symlinks from node_modules/[react|react-dom]
to node_modules/preact-compat
@jeromedane :resolve
is not supported for :npm-module
or rather it is very limited
it only works reliably for :browser
really. for :npm-module
you really need to configure it in whatever you are targetting
Ah, I see. Thanks. Suggested add > It is therefore not recommended to be used with targets that use require directly (eg. :node-script[, :npm-module]) for those of us that are a little thicker than most. Thank you!! ❤️
@gklijs asked a question about loading .wasm files in cljs
think this is a job for a smart router. if you want this custom logic. got something like this built with fulcro
@U3LP7DWPR the loading indicator isn’t the important bit though; that’s easily doable with fulcro right now; what I meant is that with suspense you could trigger data-loading at the component level
created an issue here with some context: https://github.com/thheller/shadow-cljs/issues/397
in the latest shadow, whever I do a require in the REPL I get:
another.ns> (require '[policy-fn.env :as env])
Circular dependency detected: policy-fn.env -> policy-fn.env
(require '[policy-fn.env :as env])
only custom namespaces, no core namespace like clojure.string
actually, let me differentiate more
it is a namespace that has been added to the path but at runtime, while the JVM was running
I restarted the JVM and now I receive a bunch of [:did-not-find ...]
compilation is successful
for this file the watcher does not pick up the changes
@thheller about the code you were fixing this morning why not set
instead of (into #{})
Its just a habit to use into
but yes set
would have prevented this problem. Kinda still using into
because it used to be faster ...
when I do a release build, I see this message now:
Module Entry "cambia.web.experience.dashboard.components.survey-prompt.client" was moved out of module ":survey-prompt".
It was moved to ":main" and used by #{:onboarding :survey-prompt}.
and the bundle is not created@lilactown yes I added that as a hard error because otherwise it goes by unnoticed
Using the shadow-cljs - browser quickstart
should it be possible to just do an npm install to use an npm module. I tried, https://github.com/gklijs/shadow-gol-3d (last commit, rest is copy) but it keeps saying
The required JS dependency "game-of-life-3d" is not available, it was required by "gol/main.cljs".
Searched in:/Users/gerardklijs/Workspace/shadow-gol-3d/node_modules
You probably need to run:
npm install game-of-life-3d
but when I look in node_modules it's therebut you found a bad incorrect error message for packages that don't have a main
but only module
no.. It's not really well supported yet. Even with webpack I could not get a production build. I could take the compiled javascript and serve it with webpack probably, but then I lose easy reloading.
From rust it's pretty easy to create some wasm module, also there's a lot of js/wasm interop work done.
So far in Elm I just had the basics working, but I could load and start the wasm part, and get info back through a port.
@thheller I have a Q...what can be the cause [:did-not-find policy-fn.api.query-events]
error when connecting to nrepl? it does not happen in socket REPL but it does in nrepl, I switch a couple of versions of shadow, now on 2.6.10
then a REPL command timed out.
follows
oh but has that changed? I never needed that
oh ok, so there must be something on the cider side
@gklijs is it possible to tune the wasm that gets generated? right now the .js
files imports the .wasm
and the .wasm
imports the .js
file right back
thats kind of annoying to deal with since you can't process the .js
in any meaningful way 😛
@thheller if you can help me on the shadow side I can debug what broken
cider does this:
(cider-nrepl-request:eval (format "(in-ns '%s)" ns)
(cider-repl-switch-ns-handler connection))
@richiardiandrea in-ns
is fine but what is happening BEFORE that? where is the require
or so?
it is a select-nrepl
(import "./game_of_life_3d" "__wbg_time_ff03c978915ebe44" (func $./game_of_life_3d.__wbg_time_ff03c978915ebe44 (type $t2)))
(import "./game_of_life_3d" "__wbg_timeEnd_5ba22134470392e6" (func $./game_of_life_3d.__wbg_timeEnd_5ba22134470392e6 (type $t2)))
(import "./game_of_life_3d" "__wbg_random_86efc8986c8a8805" (func $./game_of_life_3d.__wbg_random_86efc8986c8a8805 (type $t3)))
(import "./game_of_life_3d" "__wbindgen_throw" (func $./game_of_life_3d.__wbindgen_throw (type $t2)))
so no matter what it will try to import the JS file relative to the path of the wasm
well it'll work if you leave the code alone and just use it via <script type="module" ...>
so you can pass in the functions instead of the wasm file trying to load them itself
@thheller this is what is sent
(-->
id "20"
op "eval"
session "b5cba90b-dd4f-446a-81ea-2a02be297cb2"
time-stamp "2018-10-24 14:32:34.813926979"
code "(in-ns 'laputa.policy-fn.api.query-events)"
)
(<--
id "7"
session "b5cba90b-dd4f-446a-81ea-2a02be297cb2"
time-stamp "2018-10-24 14:32:34.864485854"
out "[:did-not-find laputa.policy-fn.api.query-events]
"
)
(<--
id "20"
session "b5cba90b-dd4f-446a-81ea-2a02be297cb2"
time-stamp "2018-10-24 14:32:44.826639415"
err "REPL command timed out.
"
)
right sorry 😄
this is the form sent: (do (require '[shadow.cljs.devtools.api :as shadow]) (shadow/nrepl-select %s))
after the clojure REPL boots up
let me answer all the Qs
I start with yarn shadow-cljs watch az
classpath resolved with deps.edn
I launch and connect with the above
after that I don't do any require
I connect with cider and try to switch namespace
trying
@thheller it does not seem to compile that namespace for some reason
yes I think that might be right
so weird
ok but thanks for getting my head straight
I think it would be much safer and less headache if cider just sent (require 'laputa.policy-fn.api.query-events) (in-ns 'laputa.policy-fn.api.query-events)
yeah I agree with you and I will open an issue
it does not make sense to do anything different
(in-ns 'foo.bar)
=> #object[clojure.lang.Namespace 0x25e67a35 "foo.bar"]
(+ 1 2)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: + in this context, compiling:(C:\Users\thheller\AppData\Local\Temp\form-init11452515739617339391.clj:1:1)
yep let me check with the cider folks but I totally agree
@thheller I am opening an issue in cider but I have a small suggestion for shadow as well. What if the error messages returned [:not-required .....]
? It would be clearer what you have to do next and what the problem was
ok cool I will open an issue then
thanks a lot again
ok opened and this is what happens in vanilla:
$ cljs-node-repl
[Rebel readline] Type :repl/help for online help info
cljs.user=> (in-ns 'foo.bar)
foo.bar=> (+ 1 2)
3
foo.bar=>
yeah...
uhm I would have to try on a project, will do it later ok? now I need to get stuff done for the day 😄
oh, also one day I think you suggested me to use shadow/repl
instead shadow/select-nrepl
, maybe I should PR cider
yeah 😄
ok coolio
totally, good point
(defmacro defstart! [args & body]
`(do
(defn ~'-start! ~args
~@body)
(with-meta
(defonce
~'start!
(hecate.loader/reloadable (var ~'-start!)))
{:export true :dev/after-load true})))