This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-12
Channels
- # adventofcode (67)
- # announcements (8)
- # babashka (46)
- # beginners (154)
- # calva (5)
- # cider (9)
- # clara (5)
- # clj-kondo (34)
- # cljdoc (31)
- # cljsrn (4)
- # clojure (146)
- # clojure-europe (5)
- # clojure-italy (3)
- # clojure-losangeles (2)
- # clojure-nl (149)
- # clojure-spec (22)
- # clojure-uk (73)
- # clojured (6)
- # clojurescript (95)
- # clojureverse-ops (3)
- # cryogen (7)
- # cursive (12)
- # data-science (1)
- # datomic (9)
- # docker (1)
- # emacs (1)
- # figwheel-main (1)
- # hyperfiddle (1)
- # jobs (3)
- # malli (29)
- # nrepl (2)
- # off-topic (61)
- # pathom (6)
- # pedestal (1)
- # planck (1)
- # reitit (19)
- # shadow-cljs (52)
- # spacemacs (5)
- # tools-deps (24)
- # vim (30)
- # yada (6)
> Namespaces that are known to include side-effecting macros can be blocked from caching. They won’t be cached themselves and namespaces requiring them will not be cached as well. The clara-rules library has side-effecting macros and is blocked by default. You can specify which namespaces to block globally via the :cache-blockers
configuration. It expects a set of namespace symbols. @colinkahn @lilactown
Not really having luck with :cache-blockers
. I have: :cache-blockers #{cljs.spec.test.alpha clojure.spec.test.alpha}
@colinkahn there is already special support in the caching layer regarding specs so this shouldn't be necessary
@thheller besides using st/instrument a lot I don't think so. I set up replacement mock fns before each test case, but that doesn't seem like it should cause issues. Since there is some connection to the files in .shadow-cljs
Is there something I can find in those files that might give a clue to what is causing it to break? I've looked in the folder but can't say I really understand what those files are doing.
those are the cache files. each build has its own cache. and each namespace has its own cache file in .shadow-cljs/builds/<the-build-id>/dev/ana/...
would help a lot to have something reproducible so I can see what you are actually doing
there were issues in the past with specs defining specs for other namespaces and such
@thheller I was able to create a minimal reproduction here: https://github.com/colinkahn/shadow-cljs-instrument-issue
I was able to make it even more minimal. Reproducable with a single deftest
without async
:
(deftest test-1
(st/unstrument)
(is (= (set (st/instrument)) #{`app.core/foo})))
I’m going to open an issue since I’ve played a bit more with this and don’t want keep posting stuff in here where it’s likely to get lost
instrument is rather tricky in CLJS since its a macro that does a bunch of weird stuff
I split the files a bit more and played with :cache-blockers
and was able to get it no longer fail.
But I think you mentioned that clojure spec was treated differently for caching and it seems like files that use it are not ignored in the same way that using :cache-blockers
does
In Shadow, can builds specify their source paths, or are they always specified at the top-level? For example, if I have a test build and I want to include my test sources for that but not for my production build, can I do that?
shadow-cljs by default only includes files in a build that are actually required somewhere
so if your "production" build doesn't require any of the tests then it won't be in the build
https://code.thheller.com/blog/shadow-cljs/2018/02/08/problem-solved-source-paths.html
you can always use deps.edn or project.clj to sort of get that but in regular use it shouldn't be required
@thheller Hi Thomas, anything new about React-native and the websocket management ? Follow up your first pass about this the last summer ? > first pass to properly handle react-native not closing websockets
@thheller As you don't do React native, there are a new advanced hot reloading feature (fast refresh) : https://facebook.github.io/react-native/docs/fast-refresh Maybe we can use it to "fix" the websockets problem ?
dunno how ... the react-native issue I opened was closed due to inactivity and nobody ever looked at it
I added (shadow.cljs.devtools.api/repl-runtimes-clear)
to kick out "stale" sessions
> dunno how ... the react-native issue I opened was closed due to inactivity and nobody ever looked at it Yes, I see this 😖
Thx for the information ! I will try about (shadow.cljs.devtools.api/repl-runtimes-clear)
> IMHO its a react-native bug and I hate working arround other peoples bugs Totally, I understand you
I'm having trouble using shadow-cljs, requiring a JS file that requires lodash
. For example, if I have the following line on src/dependent.js
:
import { size, isEqual } from 'lodash';
The following code on a .cljs file doesn't work:
(ns lod.main
(:require ["/dependent" :as d]))
It fails with:
Closure compilation failed with 2 errors
--- dependent.js:1
Requested module does not have an export "isEqual".
--- dependent.js:1
Requested module does not have an export "size".
Is this a known issue?
the issue is known yes. the closure compiler only really supports "strict" mode ESM interop so it complains when its fed commonjs code
support works a bit better when using require
and module.exports
so CommonJS instead of ESM