This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-11
Channels
- # architecture (1)
- # babashka (61)
- # babashka-sci-dev (1)
- # beginners (85)
- # calva (112)
- # clj-kondo (279)
- # cljdoc (16)
- # cljs-dev (15)
- # cljsrn (7)
- # clojure (168)
- # clojure-europe (36)
- # clojure-nl (10)
- # clojure-spec (6)
- # clojure-uk (5)
- # clojured (1)
- # clojurescript (20)
- # core-async (16)
- # crypto (2)
- # cursive (13)
- # datomic (25)
- # events (7)
- # fulcro (21)
- # google-cloud (3)
- # graalvm (2)
- # graalvm-mobile (2)
- # gratitude (3)
- # helix (20)
- # honeysql (4)
- # hugsql (15)
- # introduce-yourself (15)
- # leiningen (2)
- # lsp (24)
- # luminus (22)
- # malli (21)
- # meander (11)
- # midje (1)
- # other-languages (1)
- # pathom (8)
- # re-frame (5)
- # reagent (5)
- # releases (2)
- # reveal (1)
- # shadow-cljs (18)
- # spacemacs (17)
- # sql (9)
- # tools-build (12)
- # tools-deps (4)
- # vim (12)
Hi everyone! I’m trying to use aws-sdk-js-v3 but it seems to try to use nodejs modules. I’m currently getting:
The required JS dependency "http2" is not available, it was required by "node_modules/@aws-sdk/node-http-handler/dist-cjs/node-http2-handler.js".
I noticed that, I was playing with these options to try to make aws-sdk to use the browser libs
:compiler-options {:infer-externs :auto
:output-feature-set :es6}
:js-options {:provider :closure
:entry-keys ["main" "module" "browser"]}}
If I have a full stack app setup like `project/src/frontend/app/` and `project/src/backend/app` do I tell shadow-cljs that the src is in `src/frontend` and then leave `frontend` out of my namespaces like: `ns app.core` vs `ns frontend.app.core`? Or do you recommend still just declaring in my `shadow-cljs.edn` that `:source-paths ["src"]` ?
@jplaza you can set :js-options {:resolve {"http2" false}}
in your build config. that will disabled that require. I'm guessing that'll just break stuff though. it shouldn't be using a node-http-handler
for a browser build
@chase-lambert :source-paths ["src/frontend"]
, maybe this helps https://code.thheller.com/blog/shadow-cljs/2021/05/13/paths-paths-paths.html
@thheller thank you! I was able to build with that setting. Let me test things out now
Hey all, I'm trying to use the :dev-http
server with classpath:public
to serve my SPA. The documentation reads:
> By default these will serve all static files from the configured paths, and fall back to `index.html` when a resource is not found
Everything is working fine when I just load the root of the site, but when I try any other path, eg /foo/bar
I get a 404 with text Not found. Missing index.html
. I do indeed have an index.html file in that public folder, and as I've said it works fine at the root address...
Are we able to define and consume macros in the same cljc
file?
For some reason my build was only compiling properly when the cljs macros were defined and used in separate files.
So single file macro usage was failing:
;; myapp/ui.cljc
(ns myapp.ui
#?(:cljs (:require-macros [myapp.ui])))
#?(:clj (defmacro defc []))
#?(:cljs (defc component []))
But splitting up the definitions and consumption got it working:
;; myapp/ui-macros.cljc
(ns myapp.ui-macros
#?(:cljs (:require-macros [myapp.ui-macros])))
#?(:clj (defmacro defc []))
;; myapp/ui.cljs
(ns myapp.ui
(:require [my-app.ui-macros :refer [defc])
(defc component [])
Is this expected? Or could there be something wrong with my application code that may be worth trying to reproduce minimal example?CLJS doesn't support macros. they need to be defined in a .clj
file (or :clj
slice in a .cljc
file) since they are Clojure code that runs at compile time.
generally, put your macros into a separate .clj
file and require it from your clj{s,c}
file.
@alidcastano your cljc example looks fine. should work like that but writing .cljc
is much harder and much easier to make mistakes. generally easier to have two files