This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-06
Channels
- # announcements (2)
- # architecture (2)
- # aws (18)
- # babashka (7)
- # beginners (149)
- # bristol-clojurians (4)
- # calva (11)
- # chlorine-clover (1)
- # cider (8)
- # clj-kondo (2)
- # cljdoc (2)
- # cljsrn (2)
- # clojure (186)
- # clojure-canada (3)
- # clojure-europe (3)
- # clojure-gamedev (5)
- # clojure-italy (1)
- # clojure-nl (13)
- # clojure-norway (4)
- # clojure-spec (25)
- # clojure-uk (32)
- # clojurescript (75)
- # core-async (2)
- # cursive (16)
- # data-science (3)
- # datomic (20)
- # docker (1)
- # emacs (26)
- # fulcro (7)
- # graphql (1)
- # incanter (1)
- # leiningen (1)
- # luminus (7)
- # malli (7)
- # mount (11)
- # off-topic (19)
- # pathom (15)
- # re-frame (9)
- # reagent (9)
- # remote-jobs (4)
- # ring-swagger (4)
- # shadow-cljs (63)
- # spacemacs (11)
- # sql (2)
- # vscode (7)
Hello, :js-options :resolve
currently isn’t supported when building for react-native
target - is there a reason it’s not supported?
@trybeee for react-native builds metro will be responsible for resolving packages. so you need to configure it there.
In deps.edn i have reagent dependency which excludes cljsjs/react
dependency. During the build, shadow compiler fails with “react dependency is missing” so i’d like to resolve it with :js-options {:resolve {"react" {:target :global :global "React"}}
as i’m adding react.js to the page via another script
it complains about react missing only if the lib you used did (:require [react ...])
so not (:require ["react" ...])
Sorry for confusion, you’re right there is no pages in RN, i was talking about browser
target. We have multiple targets in out config. For react-native
target, we still want shadow to pull js dependency code from external file, similar to what cljs compiler option :foreign-libs
does https://cljs.github.io/api/compiler-options/foreign-libs
Also, library doing (:require [react])
is reagent as it depends on cljsjs/react (not react from node_modules).
you have a browser build that uses :js-resolve
to pick react from a global, coming from somewhere else
so what shadow-cljs does if you have (:require [react])
it'll first check if thats a regular CLJS namespace
if you have it installed somewhere else (which I assume if you use react-native you can use :js-package-dirs
Thanks for pointing to :js-package-dirs
option, it looks like that what i want. I basically want to point to the dir where to get “react” dependency from when building for react-native
Hello! Somebody know how to configure tests in react native? Because if I try to start any test with react native component it fails with syntax error in warnOnce.js file
I can't tell you how testing works in RN but you are likely going to need to use whatever they provide
When I try to run with just (default test framework for react native) I faced ‘goof is not defined’ error.
people in #cljsrn might know more. I don't use react-native myself so I can't help much
I found https://github.com/tkjone/demo-clojurescript-jest/blob/master/README.md project will try with it
Hi! I suspect that my production build in electron uses the dev version of React. I’m using re-frame and reagent and I have react och react-dom in my package.json. Does anyone know how I can tell which build is used. shadow-cljs is still quite new to me.
then create a build-report for your :browser
build via https://shadow-cljs.github.io/docs/UsersGuide.html#_build_report
(unless you configured :js-provider :require
in which case it is all electron providing the dependencies)
electron might have a setting for process.env.NODE_ENV
but I'm not sure how you'd set it
How do I use plain JS file with shadow-cljs
that declares a global variable at the top? I required it (using an absolute path), but that does not cause this variable to be available via js/Var
— is this expected? Is there a better way?
(as an aside - maybe someone has made @octocat/rest
work from NPM? it seems to depend on a Node-only package, but somehow authors also produce a release for Web without this dependency)
@dottedmag declaring it in a file does not make it global. why does it need to be a global though?
Yes, this one. Here's their bundle for Web: https://github.com/octokit/rest.js/releases/download/v16.43.1/octokit-rest.js
You can see it's var Octokit = ...;
— no AMD, not a ES6 package, so I'm at loss how to use it except <script>
in HTML and use the global.
npm install @octokit/rest
and (:require ["@octokit/rest" :as x])
what does that give you?
It gives me The required JS dependency "os" is not available, it was required by "node_modules/os-name/index.js"
ah I guess you didn't follow the instructions and didnt install shadow-cljs in the project
However I have a couple of questions: • where are the instructions? I don't see it in section (2) of the guide • what did it do to make it work?
Indeed, the guide suggests to install shadow-cljs
globally, and only reluctantly says "yes, you can install it local and use npx
"
i’m having an issue with the :node-test
target combined with watch
that makes me wonder if i’ve missed something basic. i have
:test
{:target :node-test
:output-to "out/node-tests.js"
:autorun true}
and i run npx shadow-cljs watch script test
. but when i change a file, it seems like only a subset of my tests are automatically run. if i explcitly do node out/node-tests.js
then they all run.
what am i doing wrong?my complete config is at https://gitlab.com/jjwiseman/advisory-circular/-/blob/master/shadow-cljs.edn