String requires uses js-module-exists? to check if module needs to loaded: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer.cljc#L722
It checks the compiler state for :js-module-index.
The first time e.g. react-dom/server is not found.
If using the same compiler state for recompile, the second time the module is already present in compiler-state.
This means that the module is not indexed into foreign-libs: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L2043
Result is that cljs_deps.js won't have the line for react-dom/sever or No such namespace exception about react-dom$server.