This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-26
Channels
- # announcements (4)
- # babashka (8)
- # beginners (75)
- # calva (26)
- # cider (33)
- # circleci (5)
- # clojure (36)
- # clojure-dev (2)
- # clojure-europe (25)
- # clojure-nl (4)
- # clojure-spec (38)
- # clojure-uk (47)
- # clojurescript (15)
- # cloverage (2)
- # conjure (64)
- # core-async (41)
- # cursive (13)
- # data-science (2)
- # datalog (16)
- # datascript (22)
- # datomic (9)
- # duct (2)
- # emacs (81)
- # figwheel-main (1)
- # fulcro (4)
- # jobs (2)
- # jobs-discuss (29)
- # kaocha (3)
- # meander (11)
- # membrane (21)
- # off-topic (1)
- # portal (1)
- # re-frame (1)
- # reitit (1)
- # releases (2)
- # remote-jobs (31)
- # shadow-cljs (26)
- # specter (5)
- # sql (26)
- # tools-deps (19)
- # vim (12)
Hey
I'm trying to load react-vega
and I'm getting this issue
[:zubi] Build failure:
The required JS dependency "buffer" is not available, it was required by "node_modules/vega-loader/build/vega-loader.js".
Dependency Trace:
zubi/dev.cljs
zubi/client.cljs
node_modules/react-vega/lib/index.js
node_modules/react-vega/lib/Vega.js
node_modules/react-vega/lib/utils/updateMultipleDatasetsInView.js
node_modules/react-vega/lib/utils/updateSingleDatasetInView.js
node_modules/vega-embed/build/vega-embed.js
node_modules/vega/build/vega-node.js
node_modules/vega-dataflow/build/vega-dataflow.js
node_modules/vega-loader/build/vega-loader.js
Searched for npm packages in:
/home/souenzzo/src/zubi/node_modules
See:
I think that somehow vega-loader
thinks that it's running on nodejs
(maybe ssr) and tryies to import a buffer.I'm on
thheller/shadow-cljs {:mvn/version "2.11.0"}
Using "deps"
both JVM8
and JVM14
do the same error.
npm install --save-dev shadow-cljs
and it do the hot-reoload even before I checkout logs/output
Tnks for shadow-cljs ā¤ļø
@royalaid please open an issue so I don't forgot to add it this time. working on the UI but need to solve something else first š
https://github.com/thheller/shadow-cljs/issues/782, thanks as always!
Hey there! With the following build config:
:app {:target :browser
:js-options {:resolve {"foo" {:target :npm :require "foo"}}}}
Eval-ing the following code on the REPL:
(require '["foo" :as foo])
(js/console.log foo)
I get the following:
{__esModule: true, default: Ę}
So to make an instance of foo, I have to call (foo/default.)
Is there a way to specify within the build config that default
should be āunwrappedā automatically, so that I can call (foo.)
?
What Iām trying to solve (and perhaps thereās a better way): Thereās a dependency foo
which exports a constructor function directly via a UMD. Within tests I need to substitute foo
with a mock, so Iām using a separate npm package foo-mock
which is an ESM and the constructor is under the default
export property.
The config in the end might look something like this:
:app {:target :browser
:js-options {:resolve {"foo" {:target :npm :require "foo"}}}}
:test {:target :browser-test
:js-options {:resolve {"foo" {:target :npm :require "foo-mock"}}}}
Thanks in advance!@me1676 why is the mock different from the actual? seems like a strange way to mock?
you can try :resolve {"foo" {:target :npm :require "foo-mock$default"}}
if you are on a recent version but I'm not sure that'll work
Yes, thatās an unfortunate decision by the author of foo-mock. Iāll try your suggestion
shadow-cljs 2.10.21 fails:
Build failure:
:resolve override for "foo" to "foo$default" which does not exist
{:tag :shadow.build.resolve/invalid-override, :require-from #object[java.io.File 0x4aa9328a ".../test.cljs"], :require "foo", :other "foo$default"}
Itās https://www.npmjs.com/package/pusher-js and https://www.npmjs.com/package/pusher-js-mock
to answer your other question you can use (:require ["foo" :default foo])
and direclty use (foo.)
or (:require ["foo$default" :as foo])
(new "standard" variant likely coming in next CLJS release)
the only other suggestion I can make is publishing your own npm package that uses pusher-js-mock but exports the default you want
https://github.com/thheller/shadow-cljs/issues/782, thanks as always!
How should I use a CommonJS/ES6 namespace in a ClojureScript macro? I'm following @thheller's https://code.thheller.com/blog/shadow-cljs/2019/10/12/clojurescript-macros.html, which suggests that defmacro
within a .`clj` file should use a fully-qualified namespace. But going by the shadow-cljs User Guide's https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages, I don't see how to use a fully-qualified namespace with CommonJS/ES6 imports, because they are referred to with strings as in (:require ["module-name"])
.