Fork me on GitHub

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".


why is it trying to use a node-http-handler?


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`? 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


@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...


Hm, changing my config to resources/public fixed it


that fallback only works for files, not the classpath


Ah okay yep, just changed that and it works now


I guess that could be fixed but currently it expects files


Yea no worries. The file config works fine.


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?

Braden Shepherdson19:02:10

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.

Braden Shepherdson19:02:48

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

🆗 1