我在使用 shadow-cljs 进行开发工作流程,并试图导入各种 npm 库。
对于一些如 (loadash, shortid) 来说它运行得很好,但我会在其他库如 ecpair 或 crawlee 上遇到错误。
关于 ecpair
errors in file: .../node_modules/ecpair/src/ecpair.js
{:js-str-offsets [], :js-esm false, :js-imports [], :js-invalid-requires [], :goog-provides [], :js-language "es8", :goog-module nil, :js-warnings [], :resource-name "node_modules/ecpair/src/ecpair.js", :js-requires [], :js-errors [{:line 68, :column 7, :message "'(' expected"}], :goog-requires [], :tag :shadow.build.npm/errors, :uses-global-buffer false}
ExceptionInfo: errors in file: .../node_modules/ecpair/src/ecpair.js
clojure.core/ex-info (core.clj:4739)
clojure.core/ex-info (core.clj:4739)
shadow.build.npm/get-file-info* (npm.clj:519)
shadow.build.npm/get-file-info* (npm.clj:421)
shadow.build.npm/get-file-info (npm.clj:556)
shadow.build.npm/get-file-info (npm.clj:553)
shadow.build.npm/find-resource (npm.clj:645)
shadow.build.npm/find-resource (npm.clj:605)
shadow.build.resolve/find-npm-resource (resolve.clj:110)
shadow.build.resolve/find-npm-resource (resolve.clj:80)
shadow.build.resolve/fn--11794 (resolve.clj:202)
shadow.build.resolve/fn--11794 (resolve.clj:183)
clojure.lang.MultiFn.invoke (MultiFn.java:243)
shadow.build.resolve/resolve-string-require (resolve.clj:324)
shadow.build.resolve/resolve-string-require (resolve.clj:307)
shadow.build.resolve/resolve-require (resolve.clj:491)
shadow.build.resolve/resolve-require (resolve.clj:484)
shadow.build.resolve/resolve-deps/fn--11761 (resolve.clj:58)
clojure.lang.PersistentVector.reduce (PersistentVector.java:341)
clojure.core/reduce (core.clj:6747)
clojure.core/reduce (core.clj:6730)
shadow.cljs.util/reduce-> (util.clj:47)
shadow.cljs.util/reduce-> (util.clj:46)
shadow.build.resolve/resolve-deps (resolve.clj:56)
shadow.build.resolve/resolve-deps (resolve.clj:40)
shadow.build.resolve/resolve-string-require (resolve.clj:343)
shadow.build.resolve/resolve-string-require (resolve.clj:307)
shadow.build.resolve/resolve-require (resolve.clj:491)
shadow.build.resolve/resolve-require (resolve.clj:484)
shadow.build.resolve/resolve-deps/fn--11761 (resolve.clj:58)
clojure.lang.PersistentVector.reduce (PersistentVector.java:341)
clojure.core/reduce (core.clj:6747)
clojure.core/reduce (core.clj:6730)
shadow.cljs.util/reduce-> (util.clj:47)
shadow.cljs.util/reduce-> (util.clj:46)
shadow.build.resolve/resolve-deps (resolve.clj:56)
shadow.build.resolve/resolve-deps (resolve.clj:40)
shadow.build.resolve/resolve-repl (resolve.clj:528)
shadow.build.resolve/resolve-repl (resolve.clj:514)
shadow.cljs.repl/repl-ns (repl.clj:298)
shadow.cljs.repl/repl-ns (repl.clj:291)
shadow.cljs.repl/process-read-result (repl.clj:400)
shadow.cljs.repl/process-read-result (repl.clj:380)
shadow.cljs.devtools.server.worker.impl/fn--14362 (impl.clj:693)
shadow.cljs.devtools.server.worker.impl/fn--14362 (impl.clj:657)
clojure.lang.MultiFn.invoke (MultiFn.java:233)
shadow.cljs.devtools.server.util/server-thread/fn--14076/fn--14077/fn--14085 (util.clj:294)
shadow.cljs.devtools.server.util/server-thread/fn--14076/fn--14077 (util.clj:293)
shadow.cljs.devtools.server.util/server-thread/fn--14076 (util.clj:266)
java.lang.Thread.run (Thread.java:750)
关于 crawlee
errors in file: .../node_modules/@crawlee/core/errors.js
{:js-str-offsets [], :js-esm false, :js-imports [], :js-invalid-requires [], :goog-provides [], :js-language "es3", :goog-module nil, :js-warnings [], :resource-name "node_modules/@crawlee/core/errors.js", :js-requires [], :js-errors [{:line 27, :column 24, :message "primary expression expected"}], :goog-requires [], :tag :shadow.build.npm/errors, :uses-global-buffer false}
ExceptionInfo: errors in file: .../node_modules/@crawlee/core/errors.js
clojure.core/ex-info (core.clj:4739)
clojure.core/ex-info (core.clj:4739)
shadow.build.npm/get-file-info* (npm.clj:519)
shadow.build.npm/get-file-info* (npm.clj:421)
shadow.build.npm/get-file-info (npm.clj:556)
shadow.build.npm/get-file-info (npm.clj:553)
shadow.build.npm/find-resource (npm.clj:645)
shadow.build.npm/find-resource (npm.clj:605)
shadow.build.resolve/find-npm-resource (resolve.clj:110)
shadow.build.resolve/find-npm-resource (resolve.clj:80)
shadow.build.resolve/fn--11794 (resolve.clj:202)
shadow.build.resolve/fn--11794 (resolve.clj:183)
clojure.lang.MultiFn.invoke (MultiFn.java:243)
shadow.build.resolve/resolve-string-require (resolve.clj:324)
shadow.build.resolve/resolve-string-require (resolve.clj:307)
shadow.build.resolve/resolve-require (resolve.clj:491)
shadow.build.resolve/resolve-require (resolve.clj:484)
shadow.build.resolve/resolve-deps/fn--11761 (resolve.clj:58)
clojure.lang.PersistentVector.reduce (PersistentVector.java:341)
clojure.core/reduce (core.clj:6747)
clojure.core/reduce (core.clj:6730)
shadow.cljs.util/reduce-> (util.clj:47)
shadow.cljs.util/reduce-> (util.clj:46)
shadow.build.resolve/resolve-deps (resolve.clj:56)
shadow.build.resolve/resolve-deps (resolve.clj:40)
shadow.build.resolve/resolve-string-require (resolve.clj:343)
shadow.build.resolve/resolve-string-require (resolve.clj:307)
shadow.build.resolve/resolve-require (resolve.clj:491)
shadow.build.resolve/resolve-require (resolve.clj:484)
shadow.build.resolve/resolve-deps/fn--11761 (resolve.clj:58)
clojure.lang.PersistentVector.reduce (PersistentVector.java:341)
clojure.core/reduce (core.clj:6747)
clojure.core/reduce (core.clj:6730)
shadow.cljs.util/reduce-> (util.clj:47)
shadow.cljs.util/reduce-> (util.clj:46)
shadow.build.resolve/resolve-deps (resolve.clj:56)
shadow.build.resolve/resolve-deps (resolve.clj:40)
shadow.build.resolve/resolve-string-require (resolve.clj:343)
shadow.build.resolve/resolve-string-require (resolve.clj:307)
shadow.build.resolve/resolve-require (resolve.clj:491)
shadow.build.resolve/resolve-require (resolve.clj:484)
shadow.build.resolve/resolve-deps/fn--11761 (resolve.clj:58)
clojure.lang.PersistentVector.reduce (PersistentVector.java:341)
clojure.core/reduce (core.clj:6747)
clojure.core/reduce (core.clj:6730)
shadow.cljs.util/reduce-> (util.clj:47)
shadow.cljs.util/reduce-> (util.clj:46)
shadow.build.resolve/resolve-deps (resolve.clj:56)
shadow.build.resolve/resolve-deps (resolve.clj:40)
shadow.build.resolve/resolve-symbol-require (resolve.clj:481)
shadow.build.resolve/resolve-symbol-require (resolve.clj:433)
shadow.build.resolve/resolve-require (resolve.clj:488)
shadow.build.resolve/resolve-require (resolve.clj:484)
shadow.build.resolve/resolve-entry (resolve.clj:498)
shadow.build.resolve/resolve-entry (resolve.clj:497)
clojure.lang.PersistentVector.reduce (PersistentVector.java:341)
clojure.core/reduce (core.clj:6747)
clojure.core/reduce (core.clj:6730)
shadow.cljs.util/reduce-> (util.clj:47)
shadow.cljs.util/reduce-> (util.clj:46)
shadow.build.resolve/resolve-entries (resolve.clj:509)
shadow.build.resolve/resolve-entries (resolve.clj:500)
shadow.build.modules/analyze-module/fn--12569 (modules.clj:243)
shadow.build.modules/analyze-module (modules.clj:239)
shadow.build.modules/analyze-module (modules.clj:228)
clojure.lang.PersistentVector.reduce (PersistentVector.java:341)
clojure.core/reduce (core.clj:6747)
clojure.core/reduce (core.clj:6730)
shadow.build.modules/analyze-modules (modules.clj:259)
shadow.build.modules/analyze-modules (modules.clj:258)
shadow.build.modules/analyze (modules.clj:313)
shadow.build.modules/analyze (modules.clj:304)
shadow.build/resolve (build.clj:346)
shadow.build/resolve (build.clj:340)
shadow.build/compile (build.clj:354)
shadow.build/compile (build.clj:348)
shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:251)
shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:237)
shadow.cljs.devtools.server.worker.impl/do-resource-update (impl.clj:779)
shadow.cljs.devtools.server.worker.impl/do-resource-update (impl.clj:742)
我猜这可能与 shadow-cljs 如何解释这些库有关,但我不确定如何配置 shadow-cljs.edn 来实现这一点。