Skip to content

Commit 4e3a6eb

Browse files
Add optional sourcemaps for release
1 parent 4c91df6 commit 4e3a6eb

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

build/src/nbb/build.clj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@
3939
(println "Building features:" (str/join ", " (map :name feature-configs)) "..."))
4040
(if (seq feature-configs)
4141
(apply str cmd'
42-
(map (fn [m] (format " --config-merge '%s'" (pr-str (:shadow-config m))))
43-
feature-configs))
42+
(map (fn [m] (format " --config-merge '%s'" (pr-str (:shadow-config m))))
43+
(into feature-configs
44+
[{:shadow-config {:compiler-options {:source-map true}}}])))
4445
cmd')))
4546

4647
(defn build
@@ -69,11 +70,11 @@
6970

7071
(defn release
7172
"Compiles release build."
72-
[args & {:keys [wrap-cmd-fn] :or {wrap-cmd-fn identity}}]
73+
[args & {:keys [wrap-cmd-fn include-source-map?] :or {wrap-cmd-fn identity}}]
7374
(build (wrap-cmd-fn "-M -m shadow.cljs.devtools.cli --force-spawn release modules")
7475
args)
7576
#_(spit "lib/nbb_core.js"
76-
(str/replace (slurp "lib/nbb_core.js") (re-pattern "self") "globalThis"))
77-
(run! fs/delete (fs/glob "lib" "**.map"))
77+
(str/replace (slurp "lib/nbb_core.js") (re-pattern "self") "globalThis"))
78+
(when-not include-source-map? (run! fs/delete (fs/glob "lib" "**.map")))
7879
#_(move-ext-lib "lib/nbb_schema.js" "ext/nbb-prismatic-schema/index.mjs")
7980
#_(move-ext-lib "lib/nbb_malli.js" "ext/nbb-metosin-malli/index.mjs"))

0 commit comments

Comments
 (0)