Skip to content

Commit 955fdbd

Browse files
committed
switch bundle? to return true if we see :nodejs-rt false only, :nodejs-rt
option is meaningless by itself anyway tweak main file gen
1 parent 3393544 commit 955fdbd

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/main/clojure/cljs/closure.clj

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,8 +1670,7 @@
16701670
(map preload-str syms))))
16711671

16721672
(defn bundle? [opts]
1673-
(and (= :nodejs (:target opts))
1674-
(false? (:nodejs-rt opts))))
1673+
(false? (:nodejs-rt opts)))
16751674

16761675
(defn export-dep [dep]
16771676
(str "\""dep "\": require('" dep "')" ))
@@ -1742,28 +1741,30 @@
17421741
(when-let [main (:main opts)]
17431742
[main])))))
17441743

1745-
(str (when (or (not module) (= :cljs-base (:module-name opts)))
1746-
(str (when (bundle? opts)
1747-
"import {npmDeps} from \"./npm_deps.js\";")
1748-
"var CLOSURE_UNCOMPILED_DEFINES = " closure-defines ";\n"
1749-
"var CLOSURE_NO_DEPS = true;\n"
1750-
"if(typeof goog == \"undefined\") document.write('<script src=\"" asset-path "/goog/base.js\"></script>');\n"
1751-
"document.write('<script src=\"" asset-path "/goog/deps.js\"></script>');\n"
1752-
"document.write('<script src=\"" asset-path "/cljs_deps.js\"></script>');\n"
1753-
"document.write('<script>if (typeof goog == \"undefined\") console.warn(\"ClojureScript could not load :main, did you forget to specify :asset-path?\");</script>');\n"
1754-
(when (bundle? opts)
1755-
"window.require = function(lib) {\n"
1756-
" return npmDeps[lib];\n"
1757-
"}")
1758-
(apply str (preloads (:preloads opts) :browser))))
1744+
(str
1745+
(when (bundle? opts)
1746+
"import {npmDeps} from \"./npm_deps.js\";\n")
1747+
(when (or (not module) (= :cljs-base (:module-name opts)))
1748+
(str
1749+
"var CLOSURE_UNCOMPILED_DEFINES = " closure-defines ";\n"
1750+
"var CLOSURE_NO_DEPS = true;\n"
1751+
"if(typeof goog == \"undefined\") document.write('<script src=\"" asset-path "/goog/base.js\"></script>');\n"
1752+
"document.write('<script src=\"" asset-path "/goog/deps.js\"></script>');\n"
1753+
"document.write('<script src=\"" asset-path "/cljs_deps.js\"></script>');\n"
1754+
"document.write('<script>if (typeof goog == \"undefined\") console.warn(\"ClojureScript could not load :main, did you forget to specify :asset-path?\");</script>');\n"
1755+
(apply str (preloads (:preloads opts) :browser))))
17591756
(apply str
17601757
(map (fn [entry]
17611758
(when-not (= "goog" entry)
17621759
(str "document.write('<script>goog.require(\"" (comp/munge entry) "\");</script>');\n")))
17631760
(if-let [entries (when module (:entries module))]
17641761
entries
17651762
(when-let [main (:main opts)]
1766-
[main])))))))))))
1763+
[main]))))
1764+
(when (bundle? opts)
1765+
"window.require = function(lib) {\n"
1766+
" return npmDeps[lib];\n"
1767+
"}\n"))))))))
17671768

17681769
(defn fingerprinted-modules [modules fingerprint-info]
17691770
(into {}

0 commit comments

Comments
 (0)