This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-18
Channels
- # announcements (2)
- # asami (20)
- # aws (4)
- # babashka (35)
- # beginners (47)
- # calva (65)
- # cider (19)
- # clj-kondo (63)
- # clojure (177)
- # clojure-austin (2)
- # clojure-europe (27)
- # clojure-nl (1)
- # clojure-uk (4)
- # clojurescript (13)
- # community-development (5)
- # conjure (5)
- # css (2)
- # data-oriented-programming (9)
- # datalevin (13)
- # datascript (15)
- # datomic (4)
- # devcards (6)
- # duct (4)
- # emacs (8)
- # funcool (1)
- # gratitude (2)
- # helix (3)
- # hyperfiddle (3)
- # introduce-yourself (1)
- # jobs (4)
- # jobs-discuss (26)
- # lambdaisland (2)
- # lsp (20)
- # malli (2)
- # meander (2)
- # mid-cities-meetup (5)
- # missionary (15)
- # music (4)
- # off-topic (37)
- # reagent (3)
- # reitit (2)
- # releases (2)
- # ring (18)
- # shadow-cljs (70)
- # specter (4)
- # sql (20)
- # timbre (3)
- # tools-build (43)
- # tools-deps (11)
- # vim (29)
- # xtdb (61)
Hi, I'm trying to find the source of the following issue.
Failed to inspect file
/home/foo/qux/node_modules/highlight.js/lib/languages/isbl.js
it was required from
/home/foo/qux/node_modules/highlight.js/lib/index.js
Errors encountered while trying to parse file
/home/foo/qux/node_modules/highlight.js/lib/languages/isbl.js
{:line 1, :column 1, :message "The file could not be parsed as JavaScript."}
I have two projects A
and B
. A
experiences the issue above. I have tried to trim away as much superfluous code as possible.
B
is created from scratch to match A
as closely as possible. Notably
• both projects have the exact same -Stree
output.
• Both have the exact same package.json
and produced package-lock.json
I have seen though that A
produces one extra dir though. .shadow-cljs/builds/foo/dev/shadow-js
. B
does not have this directory.
What could cause A
to produce this?Also the compile is non deterministic. Sometimes it fails, sometimes it doesn't.
My suspicion is that the https://github.com/bhauman/devcards/issues/168 no longer works with 2.19.0
(ns frontend.highlight
(:require ["highlight.js" :as hljs]))
(js/goog.exportSymbol "hljs" hljs)
(js/goog.exportSymbol "DevcardsSyntaxHighlighter" hljs)
;;;
{:ns-aliases {devcards-syntax-highlighter frontend.highlight}
well what does /home/sam/Code/pitch-app/platform/node_modules/highlight.js/lib/languages/isbl.js
look like?
as to shadow-js
missing. that is only created for :js-provider :shadow
(eg. :target :browser
) builds that use actual npm dependencies. other targets such as :npm-module
or the :node-*
variants won't produce this
Getting something fairly similar when updating to 2.19.0
Failed to inspect file
/home/dan/code/story-builder/node_modules/highlight.js/lib/languages/gml.js
it was required from
/home/dan/code/story-builder/node_modules/highlight.js/lib/index.js
Errors encountered while trying to parse file
/home/dan/code/story-builder/node_modules/highlight.js/lib/languages/gml.js
{:line 1, :column 1, :message "The file could not be parsed as JavaScript."} @
The gml.js doesn't look corrupted
what is your build :target
? any specific :compiler-options
? you sure you have the matching shadow-cljs, cljs, closure-compiler versions?
Try running your compile a few times just to be sure. Like I said it was non-deterministic for me.
:target :karma
was that the full error for you? the error should be longer showing the actual cause?
Closure compilation failed with 1 errors
--- node_modules/highlight_DOT_js/lib/languages/python.js:11
Cannot convert ECMASCRIPT_2018 feature "RegExp unicode property escape" to targeted output language.
If you're curious about the file. Only special thing I can see about it is it has some funky unicode chars
There are two workarounds for this issue that I have found:
Break the string concatenation up into multiple statements
Increase JVM stack size, e.g. -Xss8M
why are you including this in the first place? do you really need syntax highlighting for isbl? whatever that is 😛
there is also an older https://github.com/thheller/shadow-cljs/issues/780
The error is deterministic for me. It happens every time
can you try setting :jvm-opts ["-Xss8M"]
in shadow-cljs.edn (if you are not using deps.edn or project.clj, otherwise needs to be set there)
so in conclusion the new closure compiler version can't handle large strings in the stack as well as the previous version?
Feel free to add any extra info. Maybe someone will notice a regression introduced in the later version which blows up the stack in some edge cases.
Thanks for the help!
which java versions do you use? how much RAM do you have? I can't reproduce this locally in any way but my guess is that java17 with 32gb of ram sort of influences this?
I'd like to avoid a route where I bump the default stack size for every compile thread just because (like the closure compiler is doing)
just to confirm: this is due to you using re-frame-10x
right? or do you use highlight.js
in any other context?
the easiest fix for all of this is just not loading these highlight.js languages in the first place?
I'm on openJDK 11.0.15, 32GB of ram
I'm just working on a bit of an old app which uses devcards and devcards need to require highlight.js to work with shadow I suppose.
:js-options {:package-overrides {"highlight.js" {"./lib/languages/isbl.js" false}}}
would also work to just manually disable that one
I agree this work isn't worth doing just for that, but if more people start reporting problems for other npm libraries, now we know
you could also fix it manually by overriding the cljsjs require and only including the languages you want
hi everybody! When working on a shadow-cljs browser-repl, Is there a way of reloading .clj files (for macros) when they change without restarting the repl?
just work on them from the clojure repl? I typically work on macros from the clojure REPL only. often without even a CLJS build running
hmm not sure I follow, I'm tweaking some macros while trying them from cljs repl
so just running shadow-cljs browser-repl
which starts just a cljs-repl
it is not easy for me to try them on the clj repl because the macro walks over cljs macroexpanded code, like (instrument (macroexpand (defmethod foo []...))), can't try them on clojure side since defmethod macroexpands to something different
ok, I guess if I'm running a shadow-cljs clj-repl I can do a (require '[ns] :reload)
yeah, it does the trick, thanks @thheller!