This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-05
Channels
- # announcements (1)
- # babashka (61)
- # babashka-sci-dev (1)
- # beginners (54)
- # biff (17)
- # cider (4)
- # circleci (1)
- # clj-commons (39)
- # clj-kondo (26)
- # cljdoc (40)
- # clojure (41)
- # clojure-europe (32)
- # clojure-norway (4)
- # clojure-portugal (1)
- # clojure-uk (2)
- # clojurescript (59)
- # clr (69)
- # conjure (7)
- # cursive (22)
- # data-science (16)
- # datalevin (1)
- # datomic (19)
- # docker (31)
- # funcool (1)
- # honeysql (6)
- # hoplon (1)
- # hyperfiddle (41)
- # introduce-yourself (1)
- # juxt (2)
- # leiningen (5)
- # nbb (14)
- # nextjournal (38)
- # off-topic (47)
- # polylith (2)
- # rdf (5)
- # re-frame (4)
- # reitit (27)
- # releases (6)
- # scittle (10)
- # shadow-cljs (24)
- # sql (11)
- # squint (1)
- # tools-build (33)
- # tree-sitter (4)
- # vim (39)
I'm using shadow.resource/inline
so that I have access to the contents of a resource (a plain text file) in a browser setting. That means I had to https://github.com/luciolucio/holi/blob/99d59621d52b4a1193949143ab43dfb7cbf2adda/deps.edn#L6, i.e., it's now a runtime dependency for anyone that wants to use my library, which seems odd to me. Is this the way inline
is supposed to be used?
If you just want this one piece of functionality you could write a small macro that uses slurp
like this:
https://gist.github.com/noprompt/9086232
The dependency issue should be mostly harmless. Shadow is written in JVM Clojure. and no CLJS build tool would try to stuff your whole Java dependency tree into a JavaScript bundle.
The code in resource/internal
does essentially the same thing as Chris McCormick's gist above, but adds logging to and lookup from a registry, to enable Shadow to cache those resources properly.
If you wanted to remove the Shadow dep from release, while still benefiting from Shadow's caching behavior: You could add a build step for release that either swaps in your own version of the macro or fully inlines the contents of the resource files.
@UUSQUGUF3 the point of s.r/inline is that shadow-cljs is aware of it and can trigger recompiles if the resource changes https://clojureverse.org/t/using-none-code-resources-in-cljs-builds/3745
@U028ZNM1S13 I could technically split out shadow.resource into its own separate lib but haven't done so yet. if you are worried about the extra dep you can put the code from it into one of your own namespaces and just use it that way.
just take https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/resource.cljs and https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/resource.clj and give them another name
@U05224H0W every now and then I think about a PR for adding rc/inline to the Shadow user guide but then I get hung up figuring out where it would go. Maybe in "Usage" after "Running Clojure Code"?
well as I said it would be fine as a separate lib. I just don't want to maintain 15 different one ns libs π
there is also the whole shadow.cljs.modern stuff https://clojureverse.org/t/promise-handling-in-cljs-using-js-await/8998 https://clojureverse.org/t/modern-js-with-cljs-class-and-template-literals/7450
Hello all, I'm getting this error
; The result object failed to print. It is available via *1 if you want to interact with it.
;
; The exception was:
;
; #error {:message "The limit of 1048576 bytes was reached while printing.", :data {:tag :shadow.remote.runtime.writer/limit-reached, :limit 1048576}}
What is it means?It looks like whatever the result of the last expression evaluated, it was something rather large, too large to print.
Hello π
I've been able to run my tests in the cljs repl before with shadow-cljs but recently(after updating to shadow-cljs version 2.20.15), I'm getting the following error when I try to call (run-tests)
from the cljs.test
ns. I wonder if I'm missing something
; Execution error (TypeError) at (<cljs repl>:1).
; Cannot read properties of undefined (reading 'run_block')
here's how the tests I'm trying to run look like
(comment
(deftest test-smart-search-form-fields
(testing "If other fields list is truthy(not nil) then show dropdown"
(re-frame-test/run-test-sync
(js/console.log "does this work?")
(let [other-field-temp (reagent/atom "")
other-fields-focus (reagent/atom false)
other-fields ["one" "two" "three" "four"]]
(with-mounted-component
[smart-search-form-fields other-field-temp other-fields-focus other-fields]
(fn [_component]
(js/console.log (.-innerText (js/document.querySelector
"#smart-search-component")))))))))
(run-tests))
hard to say from that snippet alone. looks fine and should work. I didn't make any changes to how testing works. did you maybe upgrade shadow-cljs but not cljs or so?
Hello there, i have two builds. I am watching for the test and frontend build in one server. If I kill the watch that was started first, it kills the whole server.
{:dev-http {3449 "public"}
:builds
{:frontend
{:target :browser
:output-dir "public/js"
:module-hash-names true
:modules {:main {:init-fn app.core/init}}
:devtools {:preloads [day8.re-frame-10x.preload]}
:dev {:compiler-options
{:closure-defines
{re-frame.trace.trace-enabled? true
day8.re-frame.tracing.trace-enabled? true}}}}
:test
{:target :node-test
:output-to "out/node-tests.js"
:ns-regexp "-test$"
:autorun true}}}
Is there a way to watch for the test and frontend build in separate servers?i suspect you should just start the server in its own process so that killing either watch doesnβt kill the server
> Commands that do long-running things implicitly start a server instance (eg. watch
) but it is often advisable to have a dedicated server process running.
yeah just npx shadow-cljs server
and then you can toggle all builds via other commands or the UI at http://localhost:9630