I've been chasing an issue where we are seeing StackOverflows when compiling a CLJS project on some developer machines but not others.
I think it comes down to the fact that cljs.js-deps/dependency-order
is adding an extra require when doing the topological sort of dependencies.
(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})
Note the extra :requires ["react"]
on the second map of the output, it was not present in the input.
If the order of the inputs is switched, then the extra require does not get added:
(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})
Is this a valid issue?