This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-29
Channels
- # announcements (44)
- # architecture (12)
- # babashka (45)
- # beginners (56)
- # calva (16)
- # cider (34)
- # clj-kondo (6)
- # clojure (47)
- # clojure-austin (2)
- # clojure-brasil (3)
- # clojure-europe (39)
- # clojure-germany (2)
- # clojure-nl (1)
- # clojure-norway (39)
- # clojurescript (7)
- # cursive (1)
- # datahike (2)
- # datomic (28)
- # emacs (8)
- # gratitude (3)
- # humbleui (4)
- # hyperfiddle (45)
- # kaocha (1)
- # lsp (94)
- # nbb (2)
- # off-topic (29)
- # practicalli (8)
- # releases (2)
- # shadow-cljs (6)
- # squint (17)
- # tools-deps (12)
- # vim (11)
Hello! At random, I get a parse exception for a 3rd party JS file. The weird thing it only happens sometimes. It looks like this:
Failed to inspect file
/Users/me/Projects/external/fulcro-community/fulcro-cookbok/node_modules/highlight.js/lib/languages/isbl.js
Errors encountered while trying to parse file
/Users/me/Projects/external/fulcro-community/fulcro-cookbok/node_modules/highlight.js/lib/languages/isbl.js
{:line 1, :column 1, :message "The file could not be parsed as JavaScript."}
RuntimeException: Exception parsing "/Users/me/Projects/external/fulcro-community/fulcro-cookbok/node_modules/highlight.js/lib/languages/isbl.js"
com.google.javascript.jscomp.parsing.ParserRunner.parse (ParserRunner.java:148)
com.google.javascript.jscomp.JsAst.parse (JsAst.java:157)
com.google.javascript.jscomp.JsAst.getAstRoot (JsAst.java:63)
shadow.build.closure.JsInspector.getFileInfo (JsInspector.java:185)
shadow.build.closure.JsInspector.getFileInfoMap (JsInspector.java:199)
shadow.build.npm/get-file-info*/fn--12380 (npm.clj:371)
Any tips how to prevent it? 🙏No, not here
Maybe a case for?: https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html#option-2-js-provider-external
Hello! I have a project using https://github.com/day8/re-frame-10x, In order to get it work with shadow cljs I added the highlight.js to the package.json. It worked ok until the latest 2.24.0 shadow update. Now, I have this error when I try to start watching the cljs build with shadow:
require "./lib/languages/clojure" for package "SOME_PATH/node_modules/highlight.js" not exported
{:rel-require "./lib/languages/clojure", :package-dir #object[java.io.File 0x4a2ec8c1 "SOME_PATH/node_modules/highlight.js"], :exports {"." {"require" "./lib/index.js", "import" "./es/index.js"}, "./package.json" "./package.json", "./lib/common" {"require" "./lib/common.js", "import" "./es/common.js"}, "./lib/core" {"require" "./lib/core.js", "import" "./es/core.js"}, "./lib/languages/*" {"require" "./lib/languages/*.js", "import" "./es/languages/*.js"}, "./scss/*" "./scss/*", "./styles/*" "./styles/*", "./types/*" "./types/*"}}
ExceptionInfo: require "./lib/languages/clojure" for package "SOME_PATH/node_modules/highlight.js" not exported
shadow.build.npm/find-resource-from-exports/try-match--48154 (npm.clj:682)
shadow.build.npm/find-resource-from-exports (npm.clj:716)
shadow.build.npm/find-resource-from-exports (npm.clj:653)
shadow.build.npm/find-resource-in-package (npm.clj:747)
...
I investigated it a bit further, and found out that it's related to the addition of basic support for package.json exports. I guess something is wrong with the wildcard in the exports:
"./lib/languages/*" {"require" "./lib/languages/*.js", "import" "./es/languages/*.js"}
should probably match with the require
"./lib/languages/clojure"
Right?
I added now to my build in the shadow-cljs.edn this entry:
:js-options {:ignore-exports true}
Is this the right thing to do in that case?
Thank you.I just found that it is discussed in this issue: https://github.com/thheller/shadow-cljs/issues/1125