This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-07
Channels
- # announcements (7)
- # asami (3)
- # aws-lambda (2)
- # babashka (10)
- # beginners (30)
- # bristol-clojurians (3)
- # calva (13)
- # cider (26)
- # clj-kondo (6)
- # clojure (172)
- # clojure-europe (30)
- # clojure-italy (3)
- # clojure-nl (3)
- # clojure-serbia (9)
- # clojure-uk (64)
- # clojurescript (76)
- # conjure (9)
- # cursive (46)
- # data-science (1)
- # datomic (6)
- # emacs (13)
- # etaoin (1)
- # fulcro (27)
- # girouette (4)
- # jobs (1)
- # joker (2)
- # lsp (7)
- # malli (19)
- # meander (47)
- # off-topic (123)
- # pathom (6)
- # reitit (3)
- # remote-jobs (7)
- # reveal (37)
- # ring-swagger (2)
- # shadow-cljs (60)
- # specter (5)
- # startup-in-a-month (3)
- # tools-deps (21)
- # vim (4)
Hello, I just tried adding an NPM package called https://gildas-lormeau.github.io/zip.js/ to my project, and compilation failed with this error about a missing Babel plugin:
SyntaxError: […]/node_modules/@zip.js/zip.js/lib/core/codecs/codec-pool-worker.js: Support for the experimental syntax 'importMeta' isn't currently enabled (82:72):
80 | let messageTask;
81 | if (!workerData.interface) {
> 82 | workerData.worker = new Worker(new URL(workerData.scripts[0], import.meta.url));
| ^
83 | workerData.worker.addEventListener(MESSAGE_EVENT_TYPE, onMessage, false);
84 | workerData.interface = {
85 | append(data) {
Add @babel/plugin-syntax-import-meta () to the 'plugins' section of your Babel config to enable parsing.
I found https://github.com/thheller/shadow-cljs/issues/190 but I wasn’t sure how to proceed. One comment in there suggested that .babelrc
could somehow be used, but I’m not sure if that’s applicable here.this is not currently supported but the library seems to contain a prepackaed version without the worker via (:require ["@zip.js/zip.js/dist/zip-no-worker.min.js" :as zip])
maybe that works for you
OK cool, that might work – I’ll give it a shot. Thanks!
Are there any consequences from the new npm require syntax for Shadow-cljs? Should we prefer the official statements now?
What are the official statements?
the $
syntax has been in shadow-cljs for a long time too. it is a useful addition so use it when it make sense for you.
Ahh. That's that new one! 😄 Thanks @U05224H0W 🙂
I'm trying to set up a new project using shadow-cljs version "2.12.1".
• compile
works fine
• watch
throws piggieback-related exceptions
• Both work completely fine if I revert to version "2.11.23" (happens to be the version I use on another project).
@pmooser most likely you are using project.clj or deps.edn and have not bumped the CLJS version after bumping shadow-cljs
Hey. I'm still on my lein-figwheel -> shadow-cljs adventure 😉 Right now I'm trying to replace the cljsjs/clipboard code with the npm package. I've added the same version (1.6.1) with yarn, and required ["clipboard" :as clipboard]
instead of cljsjs.clipboard
. But how do I update this line?
(new js/Clipboard (rdom/dom-node button))
@igel your are getting rid of the js/GlobalThingy
references and just use it like any regular CLJS namespace
so just (new clipboard (rdom/dom-node button))
. just using the :as clipboard
directly
Any idea what the error IllegalStateException: Externs must contain builtin for env BROWSER: whatwg_console.js
is caused by? I'm trying to migrate everything to the newest cljs and shadow-cljs.
Yeah, I'm not sure. It doesn't happen with my old compiled artifact, but I happen to be trying pull in a local project (which I am also updating) via :local/root
. So it's interesting that if I just use the old thing it's fine.
could be an issue in in shadow-cljs, cljs, closure-compiler. hard to say without more info.
Yeah. I'm going to stop for the day soon. I'll see if I can gather some more useful information in the morning.
oh, this should be in the closure-compiler-externs
artifact I think. maybe you just excluded that by accident
That yields:
"jar:file:/Users/taronish/.m2/repository/com/google/javascript/closure-compiler-externs/v20180805/closure-compiler-externs-v20180805.jar!/externs.zip"
that looks too old yes, I get
#object[java.net.URL 0x1a418fc7 "jar:file:/C:/Users/thheller/.m2/repository/com/google/javascript/closure-compiler-unshaded/v20210302/closure-compiler-unshaded-v20210302.jar!/externs.zip"]
I'm wondering why pulling in the local project that way makes it use ancient externs, assuming that is what is happening.
hmm so I guess that might be the reason. they seem to have combined it into the closure-compiler-unshaded
and the separate closure-compiler-externs
don't exist anymore?
I'm not personally sure where this comes from ... is there any way to "tell it" to use a newer one?
good to know that might be an issue. did the lib have a direct dependency on the externs?
It is coming in because that project is pulling in: org.clojure/clojurescript 1.10.597
I'm wondering if this has been responsible for some other weirdness I've seen related to this library.
Thanks for helping me debug it - I would never have traced it back to externs like that.
what is the preferred way to do repl driven dev with shadow-cljs alongside tools.deps? I’ve got the backend using tools.deps and I would like to implement the front end with re-frame, but if I connect with vim/fireplace to the nrepl that shadow starts I can’t eval the backend related code because it cant find the libraries in the class path. Should I use tools.deps for both shadow-frontend/backend tasks?
otherwise you could run shadow-cljs as part of your backend process, using the embedded mode https://shadow-cljs.github.io/docs/UsersGuide.html#embedded
Is it expected that throwing an exception in Node.js REPL causes the runtime to exit? E.g.:
% shadow-cljs node-repl
shadow-cljs - config: /Users/dottedmag/w/hz/shadow-cljs.edn
shadow-cljs - server version: 2.12.1 running at
shadow-cljs - nREPL server started on port 52529
cljs.user=> shadow-cljs - #4 ready!
(throw "x")
^C
The previously used runtime disappeared. Will attempt to pick a new one when available but your state might be gone.
cljs.user=> Failed to read: clojure.lang.ExceptionInfo: Input/output error {:type :reader-exception, :line 2, :column 1, :file "dummy.cljs"}