Fork me on GitHub

Hi! Is there any documentation / articles about usage of :js-options {:babel-preset-config { ... }}? I'm trying to enable polyfills for IE11.


this only affects npm packages that are actually transpiled by babel. which is only a very small percentage. so much so that this option is mostly useless.


what kind of polyfills is it not detecting already? this is usually controlled by setting :compiler-options {:output-feature-set :es5} (which is the default)


you can try :es3


Oh, I see. Looks like I should be using :compiler-options, instead of :babel-preset-config, because my project probably don't have such npm packages. Thanks for your answer, I'll try it.


also note that watch/compile builds may not work in IE11 regardless of polyfill status


best to test that with release only


Got it, thanks!


Hello, everyone! I'm having a go at spinning up a Lambda function with Clojurescript via Shadow CLJS, and I'm running into a strange error that returns three results via Google. 🙂

$ yarn run shadow-cljs compile lambda --verbose
shadow-cljs - config: /home/jcf/code/example/shadow-cljs.edn
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
[:lambda] Compiling ...
-> build target: :node-library stage: :configure
<- build target: :node-library stage: :configure (3 ms)
-> Resolving Module: :main
With both release and compile I get this error after the output above:
The required namespace "example.lambda" is not available, it was required by "shadow/umd_helper.cljs".
I've found a GitHub issue related to generating single files, with a recommendation to use ncc to package everything into a single file, which I can do as soon as I have something compiling. My build looks like this:
  {:deps             {:aliases [:lambda]}
   :output-to        "amplify/backend/function/example/src/index.js"
   :target           :node-library
   :exports          {:handler example.lambda/handler}
   :devtools         {:enabled false}
   :compiler-options {:infer-externs :auto
                      :source-map    true}}}}
I've triple checked the namespace and path to my namespace and it's very correct (I've copied and pasted the name back and forth to be doubly sure).


In my deps.edn I have an alias that sets :paths ["src"]


If anyone has a working example of generating a :node-library that I can package up with ncc I'd be extremely grateful.


Definitely scratching my head on this one. :thinking_face:


Relevant links above, with two archived Slack convos coming right up…


I think tomorrow I might create a little repo to see if I can reproduce outside of my codebase. If so, I can open a decent issue on GitHub.

Mandimby Raveloarinjaka18:10:18

Hello, for my information, why do you build a "node-library" and not a "node-script" or "esm" ( Moreover, shadow-cljs will generate one js file: why do you need ncc for?

Mandimby Raveloarinjaka20:10:20

indeed I just did a small test. The target "node-lib" needs the node_modules to be bundled with the js; The target "esm" bundles everything in one js natively. However, the version of node on lambda is node 12 that does not support esm without the flag "--experimental-modules" (

👍 3

@jcf the file is supposed to be /home/jcf/code/example/src/example/lambda.cljs. make sure it actually exists. the :deps inside :builds is incorrect. it is supposed to be at the top level


I wasn’t sure if :deps could be nested. I want to use different dependencies for different builds, and went for :aliases


Is that post related to isolating dependencies declared using tools.deps’ :deps or is it to do with source paths (e.g. src/cljs)? I was trying to include a different set of third-party dependencies (my Lambda doesn’t need Rum) and have all my Clojure-like source collocated.


I’ll have a proper read in the morning to make sure I’m understanding it. Thanks, thheller! You’re work as always is appreciated. 🙇


it doesn't matter if you have rum on the classpath or not for other code


if it isn't explicitely required in any of your code it won't be used


so the lambda isn't affected at all whether its on the classpath or not

👍 3

can't see your :paths though


assuming :paths ["src"] in deps.edn is set correctly


I think I’ve done all of the above, but will double check after a good night’s rest. Thanks, thheller. 🙇


Is there an issue with shadow and macros, perhaps in the context of .cljc? I define…

(defmacro deftags [& tags]
  `(do [email protected](for [tag tags]
           `(deftag ~tag))))
…in one NS, require it in another,
(ns mxweb.tag
    [mxweb.gen :as gen]))

(gen/deftags a abbr acronym ...etc..)
…then a check reports
------ WARNING #1 - :undeclared-var --------------------------------------------
 Resource: mxweb/tag.cljc:5:2
 Use of undeclared Var mxweb.gen/deftags
A conventional CLJS build using the lein meis scripts works OK. Thx!

Karol Wójcik07:10:19

Did you include require-macros :refer [deftags] in cljc file?


@U0PUGPSFR most likely your are missing the :require-macros in the mxweb.gen ns for itself


@UJ1339K2B I started with :require-macros in the using mxweb.tag NS and was seeing the same error. Thx to @U05224H0W’s blog post I see the linkage is a bit hairier than I realized and will give it another go. btw, I had everything in .cljcs, and will start by moving macros into a .clj just to reduce the unknowns.

Karol Wójcik10:10:46

You should have put it in mxweb.gen


Yeah, that was the shocker I picked up from @U05224H0W’s blog. I did all this years ago using the mies scripts. That worked OK, but I am curious about Shadow. One puzzle is that I do not have the macros in a .clj, which I do remember as a requirement! I guess the .cljc gives me the .clj compile for the macros? Anyway, I plan to KISS and move the macros into a .clj, then set things up as you have described. Thx!


.cljc as far as CLJS macros are concerned are just two files in one. one for CLJ one for CLJS. the macro rules are exactly the same but IMHO it is much easier to follow those rules with two actual files instead of one


Yeah, I am splitting them up now. This will be a challenge for any tooling, tho: deftag generates a macro. 🙂 Results shortly…


Works like a charm. Thx @UJ1339K2B and @U05224H0W!

🎉 6