This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-20
Channels
- # announcements (5)
- # asami (7)
- # babashka-sci-dev (36)
- # beginners (50)
- # calva (47)
- # cider (1)
- # clj-kondo (19)
- # clojure (33)
- # clojure-europe (25)
- # clojure-nl (2)
- # clojure-uk (4)
- # clojurescript (26)
- # conjure (2)
- # cursive (5)
- # datalog (6)
- # fulcro (5)
- # graalvm (12)
- # leiningen (1)
- # malli (30)
- # off-topic (5)
- # rdf (4)
- # ring (11)
- # shadow-cljs (55)
I've been using a flush hook like this:
(defn flush-hook
{:shadow.build/stage :flush}
[build-state & args]
(when (= :release (:shadow.build/mode build-state))
;; My logic
)
build-state)
Lately I see that it is getting called both with my normal build names (:shadow.build/build-id build-state)
, and with '-release-snapshot' appended to them. Is that new? What is that for?when building release artifacts on something like github actions. is it a good idea to cache .shadow-cljs? or will that just bite me in the ass at some point?
@isak hmm I guess I didn't consider that. build reports just re-use the original build configs. I guess it should unset the build-hooks
@peder.refsnes the intention is to maintain the cache (ie. .shadow-cljs
) yes. it invalidates itself if something changes
Hellooo, Happy Monday! Ever since switching to a branch with some version bumps (`deps.edn` and package.json
) I've been getting a bizarre build error running shadow-cljs ... watch app
βor shadow-cljs ... server
then :Connect
ing (with https://github.com/tpope/vim-fireplace/blob/b6bef833b56632df917bcf33bc50b8a5d1e26139/doc/fireplace.txt#L19) and :CljEval
ing (do (require '[shadow.cljs.devtools.api :as shadow]) (shadow/watch :app) (shadow/nrepl-select :app))
: see below β¬οΈ
I've tried a https://stackoverflow.com/a/70490790 of https://docs.npmjs.com/cli/v8/commands/npm-ci, up to and including updating my global shadow-cljs
to the latest version, and using npx shadow-cljs
... and fiddling with the :output-feature-set
compiler option... and https://github.com/angular/clutz/issues/490#issuecomment-292236507 π
... and still nada.
Seems like people have https://clojurians-log.clojureverse.org/shadow-cljs/2020-06-02 about similar https://clojurians-log.clojureverse.org/shadow-cljs/2020-08-25 before... and it was some kinda problem in/with the closure compiler? :thinking_face:
Fwiw, this is the thing called in the last (i.e. most recent) line of the stacktrace below, afaict: https://github.com/google/closure-compiler/blob/dfa3226ec7b5197b2a1c11b4f0f4a3ee147919f4/src/com/google/javascript/jscomp/parsing/ParserRunner.java#L118
And this is the file where the stack-blowing is happening: https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/parsing/IRFactory.java
The error:
$ shadow-cljs -d nrepl/nrepl:0.8.3 -d cider/piggieback:0.5.2 -d com.billpiel/sayid:0.1.0 -d refactor-nrepl:3.0.0 -d cider/cider-nrepl:0.27.2 watch app
shadow-cljs - config: /home/carnun/Documents/Nette/nette/shadow-cljs.edn
shadow-cljs - starting via "clojure"
shadow-cljs - HTTP server available at
shadow-cljs - server version: 2.19.3 running at
shadow-cljs - nREPL server started on port 8777
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build failure:
Failed to inspect file
/home/carnun/Documents/Nette/nette/node_modules/highlight.js/lib/languages/gml.js
it was required from
/home/carnun/Documents/Nette/nette/node_modules/highlight.js/lib/index.js
Errors encountered while trying to parse file
/home/carnun/Documents/Nette/nette/node_modules/highlight.js/lib/languages/gml.js
{:line 1, :column 1, :message "The file could not be parsed as JavaScript."}
RuntimeException: Exception parsing "/home/carnun/Documents/Nette/nette/node_modules/highlight.js/lib/languages/gml.js"
com.google.javascript.jscomp.parsing.ParserRunner.parse (ParserRunner.java:148)
com.google.javascript.jscomp.JsAst.parse (JsAst.java:156)
com.google.javascript.jscomp.JsAst.getAstRoot (JsAst.java:62)
shadow.build.closure.JsInspector.getFileInfo (JsInspector.java:180)
shadow.build.closure.JsInspector.getFileInfoMap (JsInspector.java:194)
shadow.build.npm/get-file-info*/fn--12316 (npm.clj:452)
shadow.build.npm/get-file-info* (npm.clj:451)
shadow.build.npm/get-file-info* (npm.clj:401)
shadow.build.npm/get-file-info (npm.clj:512)
shadow.build.npm/get-file-info (npm.clj:509)
shadow.build.npm/find-resource-in-package (npm.clj:726)
shadow.build.npm/find-resource-in-package (npm.clj:686)
shadow.build.npm/find-resource (npm.clj:776)
shadow.build.npm/find-resource (npm.clj:739)
shadow.build.resolve/find-npm-resource (resolve.clj:122)
shadow.build.resolve/find-npm-resource (resolve.clj:93)
shadow.build.resolve/eval14445/fn--14448 (resolve.clj:262)
clojure.lang.MultiFn.invoke (MultiFn.java:244)
shadow.build.resolve/find-resource-for-string (resolve.clj:80)
shadow.build.resolve/find-resource-for-string (resolve.clj:69)
shadow.build.resolve/resolve-string-require (resolve.clj:453)
shadow.build.resolve/resolve-string-require (resolve.clj:436)
shadow.build.resolve/resolve-require (resolve.clj:669)
shadow.build.resolve/resolve-require (resolve.clj:662)
shadow.build.resolve/resolve-deps/fn--14394 (resolve.clj:51)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6885)
clojure.core/reduce (core.clj:6868)
shadow.cljs.util/reduce-> (util.clj:45)
shadow.cljs.util/reduce-> (util.clj:44)
shadow.build.resolve/resolve-deps (resolve.clj:49)
shadow.build.resolve/resolve-deps (resolve.clj:33)
shadow.build.resolve/resolve-symbol-require (resolve.clj:656)
shadow.build.resolve/resolve-symbol-require (resolve.clj:615)
shadow.build.resolve/resolve-require (resolve.clj:666)
shadow.build.resolve/resolve-require (resolve.clj:662)
shadow.build.resolve/resolve-deps/fn--14394 (resolve.clj:51)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6885)
clojure.core/reduce (core.clj:6868)
shadow.cljs.util/reduce-> (util.clj:45)
shadow.cljs.util/reduce-> (util.clj:44)
shadow.build.resolve/resolve-deps (resolve.clj:49)
shadow.build.resolve/resolve-deps (resolve.clj:33)
shadow.build.resolve/resolve-symbol-require (resolve.clj:656)
shadow.build.resolve/resolve-symbol-require (resolve.clj:615)
shadow.build.resolve/resolve-require (resolve.clj:666)
shadow.build.resolve/resolve-require (resolve.clj:662)
shadow.build.resolve/resolve-deps/fn--14394 (resolve.clj:51)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6885)
clojure.core/reduce (core.clj:6868)
shadow.cljs.util/reduce-> (util.clj:45)
shadow.cljs.util/reduce-> (util.clj:44)
shadow.build.resolve/resolve-deps (resolve.clj:49)
shadow.build.resolve/resolve-deps (resolve.clj:33)
shadow.build.resolve/resolve-symbol-require (resolve.clj:656)
shadow.build.resolve/resolve-symbol-require (resolve.clj:615)
shadow.build.resolve/resolve-require (resolve.clj:666)
shadow.build.resolve/resolve-require (resolve.clj:662)
shadow.build.resolve/resolve-deps/fn--14394 (resolve.clj:51)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6885)
clojure.core/reduce (core.clj:6868)
shadow.cljs.util/reduce-> (util.clj:45)
shadow.cljs.util/reduce-> (util.clj:44)
shadow.build.resolve/resolve-deps (resolve.clj:49)
shadow.build.resolve/resolve-deps (resolve.clj:33)
shadow.build.resolve/resolve-symbol-require (resolve.clj:656)
shadow.build.resolve/resolve-symbol-require (resolve.clj:615)
shadow.build.resolve/resolve-require (resolve.clj:666)
shadow.build.resolve/resolve-require (resolve.clj:662)
shadow.build.resolve/resolve-deps/fn--14394 (resolve.clj:51)
clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
clojure.core/reduce (core.clj:6885)
clojure.core/reduce (core.clj:6868)
shadow.cljs.util/reduce-> (util.clj:45)
shadow.cljs.util/reduce-> (util.clj:44)
shadow.build.resolve/resolve-deps (resolve.clj:49)
shadow.build.resolve/resolve-deps (resolve.clj:33)
Caused by:
StackOverflowError:
com.google.javascript.jscomp.parsing.IRFactory$TransformDispatcher.processBinaryExpression (IRFactory.java:1743)
com.google.javascript.jscomp.parsing.IRFactory$TransformDispatcher.process (IRFactory.java:2780)
com.google.javascript.jscomp.parsing.IRFactory.transform (IRFactory.java:737)
com.google.javascript.jscomp.parsing.IRFactory$TransformDispatcher.processBinaryExpression (IRFactory.java:1748)
com.google.javascript.jscomp.parsing.IRFactory$TransformDispatcher.process (IRFactory.java:2780)
com.google.javascript.jscomp.parsing.IRFactory.transform (IRFactory.java:737)
...
Any pointers would be much appreciated! πdunno how you are using highlight.js. if its via re-frame-10x you should upgrade that
well imho the answer is not including these files in the first place. I doubt very much you need gml support? whatever that even is π
re-frame-10x aye... and lowlight, via https://tiptap.dev iirc
GameMaker Language π just one of many that highlight.js ships with in its node_modules
including it when you don't need it just makes everything larger and slower (to build, load, etc)
> I mean another option is just editing this file in your node_modules folder Hmm... would this mean checking that into source control?
well I would just automate the edit in some way so it always runs after the package is installed
I mean all of this only applies if you don't control how highlight.js is used yourself
you can also use :js-options {:resolve {"highlight.js" {:target :npm :require "highlight.js/core"}}
you can then add all the languages you actually need manually in your code somewhere
possible bug report (more in the thread)
deps.edn
{:paths ["src" "tests"]
:deps {
;; ...
}
:aliases
{:shadow-cljs
{:extra-deps {thheller/shadow-cljs {:mvn/version "2.19.3"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}}}
shadow-cljs.edn
{:deps true
:builds
{;; ...
:prod
{:target :npm-module
:output-dir "dist"
;; ...
}}}
running clj -M:shadow-cljs compile prod
works as expected
shadow-cljs compile prod
, on the other hand, outputs
Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.
Full report at:
/tmp/clojure-15396811791392763534.edn
Adding thheller/shadow-cljs {:mvn/version "2.19.3"}
to :deps
solves it
It seems to me that shadow-cljs
is not calling clj
with the right alias
aaaaah
great!
I must have missed it in the user guide
thanks!
will shadow use a cljsjs dependency? [edit] nope. clearly not. e.g :dependencies [[cljsjs/something "xyz version" ]] or is it ignored and i need to use npm install something and create a cljsjs shim as per the migration docs. I'm asking because i got errors about missing libs unless i did an npm install but my worry is that the cljsjs wrapper for some libs is doing more then a 1 to 1 translation to cljs. I don't have a specific example of this happening but it would be nice to be aware i need to tackle it.
shadow-cljs does not support cljsjs packages π src: https://clojurians.slack.com/archives/C6N245JGG/p1655013153124169
so yea, it just ignores them. That's reasonable, i just had magically hoping that the migration strategy was accounting for them somehow. https://shadow-cljs.github.io/docs/UsersGuide.html#cljsjs
as I said before. if you are the one requiring cljsjs packages you should change that to use npm packages directly.
most popular libraries that use cljsjs packages have been updated to also declare :npm-deps
so the npm packages should be isntalled and used automatically
note that using npm packages directly is also what you need to be doing for :target :bundle
and most cljsjs packages have also been updated to support that.
Thanks theller.