【问题标题】:Are the added dependencies really been compiled by shadow-cljs? If so, why do the values stay the same?添加的依赖真的是shadow-cljs编译的吗?如果是这样,为什么这些值保持不变?
【发布时间】:2022-10-04 16:17:15
【问题描述】:

我正在关注 shadow-cljs快速开始有关项目最小示例的文档。这里是the link

最初,我有这个shadow-cljs.edn 文件:

;; shadow-cljs configuration
{:source-paths
 ["src/dev"
  "src/main"
  "src/test"]

 :dev-http {8080 "public"}
 :dependencies
 []

 :builds
 {:frontend
  {:target :browser
   :modules {:main {:init-fn acme.frontend.app/init}}
   }}}

/Users/pedro/projects/acme-app/src/main/acme/frontend/app.cljs,我还有:

(ns acme.frontend.app)

(defn init []
  (println "Hello World"))

我可以使用以下命令构建和观看它:

$ npx shadow-cljs compile frontend

shadow-cljs - config: /Users/pedro/projects/acme-app/shadow-cljs.edn
shadow-cljs - updating dependencies
shadow-cljs - dependencies updated
[:frontend] Compiling ...
[:frontend] Build completed. (79 files, 0 compiled, 0 warnings, 4.88s)

我一直在添加依赖项,例如:

:dependencies [[day8.re-frame/re-frame-10x "1.2.1"]
                [proto-repl "0.3.1"]
                [re-frame "1.2.0"]
                [com.degel/re-frame-firebase "0.9.6-SNAPSHOT"]
                [bidi "2.1.5"]
                [re-com "2.13.2-106-180ea1f-SNAPSHOT-TALLYFOR"]
                [com.andrewmcveigh/cljs-time "0.5.2"]
                [com.pupeno/free-form "0.6.0"]
                [binaryage/dirac "RELEASE"]
                [hickory "0.7.1"]
                [cljs-hash "0.0.2"]
                [medley "1.2.0"]]

但是,构建在filescompiledwarnings 方面没有改变。只是时间有点变化——时间可能有点随机/随机(79 files, 0 compiled, 0 warnings, 5.59s)

是依赖关系真的被编译了吗?我怎么知道依赖项是否也被编译了?

如果正在编译它们,为什么文件数保持不变?

Obs.:请注意,我没有调用依赖项中使用的函数——出于调试原因,我不想调用它们。

【问题讨论】:

    标签: file compilation clojurescript shadow-cljs


    【解决方案1】:

    添加:dependencies 的作用很小,它们不会自行编译。它们仅在the classpath 上提供。

    只有在文件的ns 形式中添加:require 或在REPL 中动态添加require 后,它们才会被编译和加载。如果没有明确的请求(即:require)来加载它们,它们只是未使用的被动资源。

    【讨论】:

      猜你喜欢
      • 2011-08-25
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 2014-09-29
      • 2016-04-01
      • 1970-01-01
      • 2021-12-17
      • 1970-01-01
      相关资源
      最近更新 更多