This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-29
Channels
- # adventofcode (11)
- # aws (2)
- # bangalore-clj (8)
- # beginners (92)
- # boot (2)
- # calva (26)
- # cider (1)
- # clj-kondo (4)
- # cljs-dev (4)
- # clojure (54)
- # clojure-berlin (5)
- # clojure-houston (6)
- # clojure-italy (12)
- # clojure-nl (7)
- # clojure-uk (39)
- # clojurescript (12)
- # clojutre (6)
- # cryogen (1)
- # cursive (15)
- # datomic (11)
- # duct (1)
- # events (5)
- # fulcro (14)
- # jackdaw (1)
- # joker (2)
- # malli (15)
- # mental-health (1)
- # off-topic (35)
- # reagent (2)
- # reitit (24)
- # rewrite-clj (3)
- # shadow-cljs (19)
- # vim (11)
probably OK to ignore. there haven’t been any breaking changes between 16.9 and 16.12
Is it possible to conditionally require a different namespace based on a goog-define variable?
I see https://shadow-cljs.github.io/docs/UsersGuide.html#_conditional_reading but that's for .cljc files and I want to use this from a .cljs file (stub out a mixpanel dependency in dev)
I've just added a scoped JS dep with yarn
, but Shadow doesn't appear to find its dependencies. I guess because yarn installs them in node_modules/@my-scope/my-package/node_modules
? Anyone have any suggestions on how I could get these deps seen by shadow, aside from adding them all explicitly to my project's package.json
?
@orestis conditional requires are not supported. you can however change what JS dependencies resolve to. https://shadow-cljs.github.io/docs/UsersGuide.html#js-resolve
so :js-options {:resolve {"mixpanel" false}}
would cause (:require ["mixpanel"])
to not do anything
@mel.collins yarn should not be installing the dependencies into a nested node_modules
dir? it usually only does this in cases on version conflicts which you'll need to resolve
Aha gotcha, thanks. Got it in the main node_modules
after fixing diverged react versions.
What confused me was that the package it was complaining about wasn't depended on by anything else, and only existed in the one (nested) node_modules
. But it seems that if any of the package's deps conflict, all of its deps go in the nested folder.
Okay, so I got my dep installed properly, but my next stumbling block is that when my ns requires ["@my-scope/my-package/feature" :as my-feature]
it works perfectly when accessing the page of my :npm-module
build, but in the test (`:target :karma`) build I get: "The required JS dependency "@my-scope/my-package/feature" is not available ...". Not sure what I could be missing. 😕
when using :npm-module
you are likely using webpack or something as the final bundler that'll provide the JS
Hmm, we do use webpack, but it looks like the released (npm) package works fine, just not the yarn link
ed version. I guess something, somewhere, isn't getting correctly pointed to the package's dist/
subdir to find the compiled (yup, from TypeScript) JS files.