This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-19
Channels
- # ai (4)
- # announcements (1)
- # babashka (6)
- # beginners (31)
- # biff (1)
- # calva (11)
- # cider (9)
- # clerk (6)
- # clojure (40)
- # clojure-europe (49)
- # clojure-nl (1)
- # clojure-norway (30)
- # clojurescript (17)
- # conjure (1)
- # core-async (2)
- # datalevin (28)
- # emacs (1)
- # events (4)
- # fulcro (7)
- # gratitude (1)
- # guix (4)
- # hyperfiddle (19)
- # juxt (10)
- # luminus (4)
- # malli (4)
- # missionary (11)
- # nbb (3)
- # pedestal (7)
- # reagent (27)
- # reitit (2)
- # releases (1)
- # shadow-cljs (32)
- # tools-deps (6)
- # xtdb (5)
probably better ask in #C03S1KBA2 or #C03S1L9DN? doesn't sound like a shadow-cljs question
Hi folks - is there a way to output a standalone node-script with macchiato? It uses these unhelpful (node/require "http")
(where node
is cljs.nodejs
), that seem to be output verbatim by shadow-cljs. Can I somehow get those to bundle the req's properly?
never looked at macchiato? can you point me to the sources? is there any particular reason they are doing this instead of just over the ns
form?
I've been wondering whether I should just "fork" macchiato and replcae them all with the ns form. Just trying to avoid the work if at all possible.
I've used macchiato-core with node-script just fine. What specific errors do builds give you?
It builds & works fine, if the npm modules are available. But it isn't standalone - you need to install certain npm modules.
(ns macchiato.cookies
(:require
[cljs.nodejs :as node]))
(def ^:no-doc Cookies (node/require "cookies"))
(def ^:no-doc random-bytes (node/require "random-bytes"))
> That's because macchiato-core depends on external node modules I'm aware, but shadow-cljs can normally bundle things just fine
(ns macchiato.cookies
(:require
["cookies" :as Cookies]
["random-bytes" :as random-bytes]))
I see. I’ve personally never gotten node scripts to bundle everything into a single file. I’ve always assumed npm install
was necessary to run scripts using libs beyond the stdlib
re: macchiato: IIRC macchiato was written when people were still using lein-cljsbuild and NPM support was shoddy at best with existing tooling (mostly cljsbuild and figwheel)
Yea, I'll probably do that - just make my own macchiato copy with those things changed to the ns form.
You can find use of require
in let
forms, which I find pretty ugly. I’ve never bothered sending PRs fixing them because in the end macchiato-core has more or less “just worked” for me. And the repository itself doesnt seem maintained.
I have no other suggestion to make, there isn't an easy way to bundle things hidden from the bundler like that
@Alex H With that said… if you’re willing to fork macchiato-core, I’m willing to help maintain it, since I have some projects that rely on it for SSR with React
I've submitted a PR upstream: https://github.com/macchiato-framework/macchiato-core/pull/53 In the meantime, I'll just use my own fork as a git dep.
I have no plans of maintaining it in any meaningful way, FWIW - just the bare minimum that works for me.
FWIW, the PR above is now merged upstream, and also available on clojars from 0.2.24 onwards.
If shadowcljs uses cljs 1.11.57, does it mean I'm implicitly using 1.11.57 as well? Or is it only version shadowcljs is built with?
Question about using deps aliases with shadow:
I'm using nubank/workspaces and I would like to move that dep to a deps.edn alias, e.g. :ws
alias. My shadow-cljs takes deps from deps.edn. I know I can provide list of aliases to shadow.cljs under :deps
ins shadow-cljs.edn.
Is it possible use such a :ws
alias during shadow-cljs watch, but not during a release?
You use the CLJS and google-closure-library bundled with Shadow, correct. Similarly, other libraries (like core.async) have implicitly fixed versions to ensure nothing about shadow breaks
The exception to this is if you set :lein true
or :deps true
, which in case you are solely responsible for providing dependencies that work with shadow (e.g. if you pull in a newer clojurescript than what your version of shadow-cljs depends on, then you may unknowingly break shadow)
