我在某些开发机的 CLJS 项目编译中遇到了堆栈溢出的问题,但其他地方没有。
我认为这归结于在执行依赖关系拓扑排序时,cljs.js-deps/dependency-order
添加了一个额外的依赖。
(require '[cljs.js-deps :as deps])
=> nil
(deps/dependency-order
'({:file "libs.js", :provides ["react" "cljsjs.react"], :requires [] :foreign true}
{:file "libs.js", :provides ["react" "react-dom" "webpack.bundle"] :foreign true}
{:file "libs.js" :provides ["react-dom" "cljsjs.react.dom"], :requires ["react"] :foreign true}))
=>
({:file "libs.js", :provides ["react" "cljsjs.react"], :requires [], :foreign true}
{:file "libs.js", :provides ["react" "react-dom" "webpack.bundle"], :foreign true, :requires ["react"]}
{:file "libs.js", :provides ["react-dom" "cljsjs.react.dom"], :requires ["react"], :foreign true})
注意输出中的第二个映射多了一个额外的 :requires ["react"]
,输入中没有。
如果输入顺序改变,则不会添加额外的依赖。
(deps/dependency-order
'({:file "libs.js", :provides ["react" "react-dom" "webpack.bundle"] :foreign true}
{:file "libs.js", :provides ["react" "cljsjs.react"], :requires [] :foreign true}
{:file "libs.js" :provides ["react-dom" "cljsjs.react.dom"], :requires ["react"] :foreign true}))
=>
({:file "libs.js", :provides ["react" "react-dom" "webpack.bundle"], :foreign true, :requires []}
{:file "libs.js", :provides ["react" "cljsjs.react"], :requires [], :foreign true}
{:file "libs.js", :provides ["react-dom" "cljsjs.react.dom"], :requires ["react"], :foreign true})
这是一个有效的问题吗?