Fork me on GitHub
#shadow-cljs
<
2019-11-29
>
lilactown00:11:42

probably OK to ignore. there haven’t been any breaking changes between 16.9 and 16.12

orestis08:11:24

Is it possible to conditionally require a different namespace based on a goog-define variable?

orestis08:11:11

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)

romdoq10:11:25

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?

thheller10:11:38

@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

thheller10:11:08

so :js-options {:resolve {"mixpanel" false}} would cause (:require ["mixpanel"]) to not do anything

thheller10:11:55

@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

romdoq11:11:08

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.

thheller11:11:56

could be .. don't know how yarn/npm handle this these days

romdoq15:11:51

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

thheller15:11:54

when using :npm-module you are likely using webpack or something as the final bundler that'll provide the JS

thheller15:11:17

for karma shadow-cljs will try to build it

thheller15:11:32

so if you have custom webpack config for the package that won't apply

thheller15:11:42

or if the package is written in typescript shadow-cljs won't recognize it

thheller15:11:56

could be affected by many things ...

romdoq15:11:28

Hmm, we do use webpack, but it looks like the released (npm) package works fine, just not the yarn linked 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.

romdoq16:11:14

I'll pick this up again on Monday, with hopefully clearer eyes

kstehn21:11:47

hey guys quick question is it possible to generate a test report xml-file that is compatible with circleci when the target for the test is :node-test ?

thheller22:11:00

not built-in no. you could make your own runner that generates it though.