This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-28
Channels
- # babashka (29)
- # beginners (179)
- # bristol-clojurians (1)
- # calva (9)
- # chlorine-clover (47)
- # cider (57)
- # clj-kondo (1)
- # cljs-dev (13)
- # clojure (241)
- # clojure-europe (9)
- # clojure-nl (4)
- # clojure-norway (88)
- # clojure-spec (4)
- # clojure-uk (15)
- # clojurescript (211)
- # clojutre (1)
- # community-development (8)
- # core-async (1)
- # datomic (31)
- # figwheel-main (33)
- # fulcro (29)
- # ghostwheel (6)
- # graalvm (11)
- # graphql (12)
- # instaparse (4)
- # jobs (1)
- # jobs-discuss (17)
- # leiningen (7)
- # malli (6)
- # meander (38)
- # off-topic (208)
- # onyx (6)
- # re-frame (23)
- # reagent (8)
- # shadow-cljs (61)
- # spacemacs (10)
- # sql (5)
- # yada (5)
I’m trying to use the npm library video.js
The JS docs for video.js (https://docs.videojs.com/tutorial-react.html) for use in react says:
import videojs from 'video.js'
and use it like this:
this.player = videojs(this.videoNode, this.props ...)
I do a require in my cljs file:
(:require
["video.js" :as vjs])
and I’ve tried
(:require
["video.js" :default videojs])
But in the first case vjs/videojs
is undefined as is videojs
in the second case.
Am I doing something stupid, or is something amiss like having the .
in the package name is screwing things up?I just tried putting the actual js file video.js
into my work directory and require it as ["./video.js" :as vjs]
and ["./video.js" :default videojs]
and its behaving the same so I don’t think it’s because of the period. Its something with video.js is setup? They use videojs
both as the. top namespace and as the function that effectively instantiates the instance. I don’t know it that is particularly weird for JS or not… They mention it in their docs on videojs
:
> The `videojs()` function doubles as the main function for users to create a https://docs.videojs.com/Player.html instance as well as the main library namespace. - https://docs.videojs.com/module-videojs-videojs.html
Hmm, if I put <script src="
in my index.html and remove the requires for video.js
and refer to it as js/videojs it works….
@rberger it probably is (:require ["video.js" :as videojs])
and videojs
directly, not the vjs/videojs
alias you tried before.
@thheller That seems to have been it. Now I just. have to figure out how to actually use this thing. Its showing up in my dom as a video element but not playing my streams. But this isn’t a shadow-cljs problem! Thanks again!
By the way, this really tweaks my mental model of :require and :as I always had assumed the :as value was an arbitrary label/symbol…
yeah its weird but string requires are the exception to the rule of :as
being just an alias for alias/foo
Hi. I am getting the following error when I try to compile any shadow-cljs
target from my project. It used to work, but now it errors and I am not sure what changed. Maybe you can help me out figuring out what is wrong:
shadow-cljs - starting via "clojure"
[:dev] Compiling ...
Execution error (AssertionError) at shadow.build.data/add-source (data.clj:214).
Assert failed: (rc/valid-resource? rc)
Full report at:
/tmp/clojure-1306074555799542362.edn
thanks in advance 🙂
of shadow-cljs
? 2.9.10
(I was on 2.8.83 and got the same error, updated, got a nicer error message 🙂 but still the same issue)
(in-ns 'shadow.build.data)
(defn add-source [state {:keys [resource-id resource-name] :as rc}]
(when-not (rc/valid-resource? rc)
(throw (ex-info "invalid resource" {:rc rc})))
(-> state
(update :sources assoc resource-id rc)
(add-provides rc)
(cond->
resource-name
(update :name->id assoc resource-name resource-id)
)))
shadow.build.data=> (shadow.cljs.devtools.api/compile :dev)
[:dev] Compiling ...
invalid resource
{:rc {:cache-key ["5b0a111dc988bc0136ede52338f0c7cd98f61a45"], :ns-info {:rename-macros nil, :renames {}, :meta {:file "repl.cljs", :line 1, :column 5, :end-line 1, :end-column 9}, :use-macros nil, :excludes #{}, :name repl, :imports nil, :requires {cljs-bean.core cljs-bean.core, cljs.pprint cljs.pprint, pprint cljs.pprint, promesa.core promesa.core, p promesa.core, cljs.core cljs.core, goog goog}, :seen #{:require}, :uses {->clj cljs-bean.core}, :require-macros {cljs.core cljs.core}, :cljc false, :flags {:require #{}}, :js-deps {}, :deps [goog cljs.core cljs-bean.core cljs.pprint promesa.core]}, :ns repl, :output-name "repl.js", :file #object[java.io.File 0x32a1aabf "/home/diogovasconcelos/git-projects/core-banking-repos/core-banking-platform/service/banking-errands/dev/repl.cljs"], :resource-id [:shadow.build.classpath/resource "repl.cljs"], :resource-name "repl.cljs", :type :cljs, :last-modified -3600000, :requires #{cljs-bean.core promesa.core cljs.core goog cljs.pprint}, :macro-requires #{cljs.core}, :url #object[java.net.URL 0x6b7f46f6 "file:/home/diogovasconcelos/git-projects/core-banking-repos/core-banking-platform/service/banking-errands/dev/repl.cljs"], :provides #{repl}, :deps [goog cljs.core cljs-bean.core cljs.pprint promesa.core]}}
ExceptionInfo: invalid resource
shadow.build.data/add-source (NO_SOURCE_FILE:14)
shadow.build.data/add-source (NO_SOURCE_FILE:12)
shadow.build.data/maybe-add-source (data.clj:267)
shadow.build.data/maybe-add-source (data.clj:259)
shadow.build.resolve/resolve-symbol-require (resolve.clj:550)
shadow.build.resolve/resolve-symbol-require (resolve.clj:510)
shadow.build.resolve/resolve-require (resolve.clj:561)
shadow.build.resolve/resolve-require (resolve.clj:557)
shadow.build.resolve/resolve-entry (resolve.clj:571)
shadow.build.resolve/resolve-entry (resolve.clj:570)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6827)
clojure.core/reduce (core.clj:6810)
shadow.cljs.util/reduce-> (util.clj:47)
shadow.cljs.util/reduce-> (util.clj:46)
shadow.build.resolve/resolve-entries (resolve.clj:582)
shadow.build.resolve/resolve-entries (resolve.clj:573)
shadow.build.modules/resolve-module/fn--14145 (modules.clj:265)
shadow.build.modules/resolve-module (modules.clj:261)
shadow.build.modules/resolve-module (modules.clj:251)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6827)
clojure.core/reduce (core.clj:6810)
shadow.build.modules/resolve-modules (modules.clj:271)
shadow.build.modules/resolve-modules (modules.clj:270)
shadow.build.modules/analyze (modules.clj:325)
shadow.build.modules/analyze (modules.clj:316)
shadow.build/resolve (build.clj:395)
shadow.build/resolve (build.clj:389)
shadow.build/compile (build.clj:403)
shadow.build/compile (build.clj:397)
shadow.cljs.devtools.api/compile* (api.clj:315)
shadow.cljs.devtools.api/compile* (api.clj:311)
shadow.cljs.devtools.api/compile!/body-fn--17311--auto----17398 (api.clj:324)
shadow.cljs.devtools.api/compile! (api.clj:322)
shadow.cljs.devtools.api/compile! (api.clj:319)
shadow.cljs.devtools.api/compile (api.clj:331)
shadow.cljs.devtools.api/compile (api.clj:326)
shadow.cljs.devtools.api/compile (api.clj:328)
shadow.cljs.devtools.api/compile (api.clj:326)
shadow.build.data/eval38637 (NO_SOURCE_FILE:22)
shadow.build.data/eval38637 (NO_SOURCE_FILE:22)
clojure.lang.Compiler.eval (Compiler.java:7177)
clojure.lang.Compiler.eval (Compiler.java:7132)
clojure.core/eval (core.clj:3214)
clojure.core/eval (core.clj:3210)
shadow.cljs.devtools.server.socket-repl/repl/fn--17818 (socket_repl.clj:63)
clojure.main/repl/read-eval-print--9086/fn--9089 (main.clj:437)
clojure.main/repl/read-eval-print--9086 (main.clj:437)
clojure.main/repl/fn--9095 (main.clj:458)
clojure.main/repl (main.clj:458)
clojure.main/repl (main.clj:368)
shadow.cljs.devtools.server.socket-repl/repl (socket_repl.clj:30)
shadow.cljs.devtools.server.socket-repl/repl (socket_repl.clj:28)
shadow.cljs.devtools.server/from-cli (server.clj:678)
shadow.cljs.devtools.server/from-cli (server.clj:589)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core/apply (core.clj:665)
clojure.core/apply (core.clj:660)
shadow.cljs.devtools.cli-actual/lazy-invoke (cli_actual.clj:23)
shadow.cljs.devtools.cli-actual/lazy-invoke (cli_actual.clj:20)
shadow.cljs.devtools.cli-actual/blocking-action (cli_actual.clj:129)
shadow.cljs.devtools.cli-actual/blocking-action (cli_actual.clj:116)
shadow.cljs.devtools.cli-actual/main (cli_actual.clj:177)
shadow.cljs.devtools.cli-actual/main (cli_actual.clj:132)
clojure.core/apply (core.clj:669)
clojure.core/apply (core.clj:660)
shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:219)
shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:217)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core/apply (core.clj:665)
clojure.core/apply (core.clj:660)
shadow.cljs.devtools.cli/-main (cli.clj:75)
shadow.cljs.devtools.cli/-main (cli.clj:67)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core/apply (core.clj:665)
clojure.main/main-opt (main.clj:514)
clojure.main/main-opt (main.clj:510)
clojure.main/main (main.clj:664)
clojure.main/main (main.clj:616)
-3600000 - failed: nat-int? in: [:last-modified] at: [:last-modified] spec: :shadow.build.resource/last-modified
:error
thanks for looking into this so quickly btw 🙂
can you check stat /home/diogovasconcelos/git-projects/core-banking-repos/core-banking-platform/service/banking-errands/dev/repl.cljs
or so?
yeah, something is screwed with the modify date on that file:
File: /home/diogovasconcelos/git-projects/core-banking-repos/core-banking-platform/service/banking-errands/dev/repl.cljs
Size: 596 Blocks: 8 IO Block: 4096 regular file
Device: fd01h/64769d Inode: 9570063 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1001/diogovasconcelos) Gid: ( 1001/diogovasconcelos)
Access: 2020-05-28 10:43:16.172569415 +0200
Modify: 1970-01-01 00:00:00.000000000 +0100
Change: 2020-05-20 14:58:43.953551480 +0200
Birth: 2020-02-21 10:50:27.964589751 +0100
and I updated it and now the dates are correct. It still fails. I am going to check if other files got this problem and let you know
yeah. all the files had the dates screwed (and I think you are right, I did mess with docker and mounting this folder). It works now (I re-cloned the repo)
thanks a lot!!!
sorry for the trouble
Hello guys, How can I use the "shadow.user" ns that emacs initiates using npx shadow-cljs
but starting from cider?
I'm having some trouble using cider to start a repl and simply using:
(ns user
(:require
[shadow.cljs.devtools.api :as shadow.api]
[shadow.cljs.devtools.server :as shadow.server]))
(defn -main
{:shadow/requires-server true}
[& _]
(shadow.server/start!)
(shadow.api/watch :my-project))
when I use, (shadow.api/rep :my-project)
I don't have a repl on cider's repl, I have a repl on stdin on emacs
@d.ian.b if you get a stdin REPL you are not connecting to the shadow-cljs nrepl server
yeah, there's a way to start to shadow-cljs nrepl from clj with cider?
but if you connect to the nrepl provided by it you can just configure the shadow-cljs middleware
there's a way to use this on clj tools.deps?
cider defaults to using .nrepl.edn
or so I think. ask in #cider about how to configure middleware
I don't use cider so I have no clue how current the instructions here are https://shadow-cljs.github.io/docs/UsersGuide.html#cider
[:ddplugin] Configuring build.
[:ddplugin] Compiling ...
[:ddplugin] Build failure:
no output for id: [:shadow.build.classpath/resource "goog/base.js"]
{:resource-id [:shadow.build.classpath/resource "goog/base.js"]}
ExceptionInfo: no output for id: [:shadow.build.classpath/resource "goog/base.js"]
shadow.build.data/get-output! (data.clj:196)
shadow.build.data/get-output! (data.clj:192)
shadow.build/enhance-warnings (build.clj:26)
shadow.build/enhance-warnings (build.clj:22)
shadow.build/extract-build-info/fn--53837 (build.clj:97)
clojure.core/map/fn--5866 (core.clj:2753)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:51)
clojure.lang.RT.seq (RT.java:535)
clojure.core/seq--5402 (core.clj:137)
clojure.core.protocols/seq-reduce (protocols.clj:24)
clojure.core.protocols/fn--8146 (protocols.clj:75)
clojure.core.protocols/fn--8146 (protocols.clj:75)
clojure.core.protocols/fn--8088/G--8083--8101 (protocols.clj:13)
clojure.core/reduce (core.clj:6828)
clojure.core/into (core.clj:6895)
clojure.core/into (core.clj:6887)
shadow.build/extract-build-info (build.clj:99)
shadow.build/extract-build-info (build.clj:69)
shadow.build/update-build-info-after-compile (build.clj:107)
shadow.build/update-build-info-after-compile (build.clj:105)
shadow.build/compile (build.clj:407)
shadow.build/compile (build.clj:397)
shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:345)
shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:327)
shadow.cljs.devtools.server.worker.impl/eval55641/fn--55643 (impl.clj:779)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
shadow.cljs.devtools.server.util/server-thread/fn--55247/fn--55248/fn--55256 (util.clj:285)
shadow.cljs.devtools.server.util/server-thread/fn--55247/fn--55248 (util.clj:284)
shadow.cljs.devtools.server.util/server-thread/fn--55247 (util.clj:257)
java.lang.Thread.run (Thread.java:830)