                 ;; will mess up source maps otherwise
                 ;; append is fine
                 final-output
-                (str prepend
-                     (when (and any-shadow-js? goog-base)
+                (str (when (and any-shadow-js? goog-base)
                        "var shadow$provide = {};\n")
+                     prepend
                      shadow-js-prepend
                      output
                      append

                    (-> {(util/flat-filename resource-name) source-map}
                        (sm/encode* sm-opts)
                        (dissoc "lineCount") ;; its nil which closure doesn't like
                        (assoc "sources" [resource-name])
                        )]

                (json/write-str source-map-v3 :escape-slash false)))]

          src-map-file
          (io/file (str (.getAbsolutePath js-file) ".map"))

          use-fs-path?
          (true? (get-in state [:compiler-options :source-map-use-fs-paths]))

          ;; FIXME: make this use encode-source-map from above
          source-map-json
          (or source-map-json
              (let [sm-opts
