shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
tony.kay 2020-09-14T00:00:22.288700Z

I can’t seem to get it to work

tony.kay 2020-09-14T00:00:28.288900Z

for cljs namespaces, that is

thheller 2020-09-14T07:19:26.289700Z

@tony.kay for CLJS its :build-options {:ns-aliases {a b}}. eg. https://github.com/day8/re-frame-debux#option-2-namespace-aliases-with-shadow-cljs

1πŸ‘
2020-09-14T10:45:24.290900Z

hi everybody! is there a way to specify general :exclusions in shadow-cljs.edn like there is in lein?

thheller 2020-09-14T12:00:22.291100Z

@jpmonettas exactly like in lein, :dependencies [[some-dep "version" :exclusions [foo]]

2020-09-14T12:09:18.291800Z

yeah but is there a general :exclusions, like this one https://github.com/technomancy/leiningen/blob/stable/sample.project.clj#L89-L92

thheller 2020-09-14T12:13:10.292800Z

that is not supported. what are you trying to exclude? I mean its rather uncommon to get an unwanted dep from multiple sources?

2020-09-14T12:45:23.295100Z

I'm working on a project where a bunch of our libraries depend on mount. For one of the projects that uses all those, I want to work with a fork of mount I made, so I want to exclude all mount dependencies everywhere since I want to provide the one to use. Does it make sense?

2020-09-14T12:47:44.296200Z

I'm in the process of migrating this project to shadow-cljs, and the current project is using that lein functionality

pithyless 2020-09-14T13:17:22.298300Z

@jpmonettas are you using deps.edn? Because you can create an alias with :override-deps to point to your fork; and then pull in the deps via alias in shadow.

robert-stuttaford 2020-09-14T13:17:53.298900Z

help πŸ™‚ how do i express this: import Select, { components } from 'react-select'; in this:

(ns yep
  (:require ["react-select" :default react-select]
            ["react-select/async" :default react-select-async]))
I also need to import Option from "react-select" somehow

2020-09-14T13:22:14.300500Z

@pithyless I don't think :override-deps works since they are different artifacts, not different versions, I'm including district0x/mount and want to exclude mount since the both contains the same namespaces

pithyless 2020-09-14T13:26:41.301Z

This would work if you reference the git repo:

{mount {:git/url "<https://github.com/district0x/mount>" :sha ...}}
(But you would need to add a deps.edn to your forked repo)

pithyless 2020-09-14T13:27:20.301200Z

I wonder if you can specify an alternative mvn root... {:mvn/version "..." :mvn/artifact ...}

pithyless 2020-09-14T13:35:24.301500Z

Looks like the groupId/artifactId stuff is hardcoded for :mvn; but that forked git repo would work.

2020-09-14T14:07:45.301700Z

yeah not sure what to do, I think I'll just add exclusions per dependency, but is kind of error prone, if I miss one then I'll have some hard to track bugs

2020-09-14T14:08:36.301900Z

thanks for your ideas !!

Mark Gerard 2020-09-14T14:12:44.302600Z

Hiya, I am getting this error when I try to run my tests:

Resource: com/cognitect/transit.js:649:8
 variable module is undeclared
--------------------------------------------------------------------------------
nil
========= Running Tests =======================
internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'xmlhttprequest'

Mark Gerard 2020-09-14T14:12:51.302900Z

Any pointers on how to fix this?

thheller 2020-09-14T14:23:37.304100Z

npm install xmlhttprequest? Guess you are using :node-test and a library that does a require("xmlhttprequest") somewhere?

Mark Gerard 2020-09-14T14:25:28.304700Z

I am using shadow-cljs compile test. I added a dependency to use cljs-ajax

thheller 2020-09-14T14:30:36.305400Z

so yeah npm install xmlhttprequest should fix it

Mark Gerard 2020-09-14T14:38:58.305600Z

thanks

thheller 2020-09-14T16:42:57.306700Z

@robert-stuttaford see the translation table at https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages (:require ["react-select" :as react-select :default Select :refer (Option)]) or so