                        (remove #(str/includes? js (str "(\"" % "\")")))
                        (into #{}))
 
-                  sw
-                  (StringWriter.)
-
-                  ;; for sourcesContent
-                  _ (.addSourceFile source-map source-file)
-                  _ (.appendTo source-map sw output-name)
-
                   sm-json
-                  (.toString sw)
+                  (when generate-source-map?
+                    (let [sw (StringWriter.)]
+                      ;; for sourcesContent
+                      (.addSourceFile source-map source-file)
+                      (.appendTo source-map sw output-name)
+                      (.toString sw)))
 
                   deps
                   (data/deps->syms state rc)

           ;; doesn't really impact much here anyways
           :language-in :ecmascript-next
           :language-out :ecmascript5}
          (dissoc js-options :resolve))

        property-collector
        (PropertyCollector. cc)


        co-opts
        (merge
          ;; :whitespace or :simple work but some patterns really require the DCE done by :simple
          ;; eg some conditional imports done by react&friends
          {:optimizations :simple
           :pretty-print false
           :pseudo-names false
           ;; es6+ is transformed by babel first
