         ;; since it is the initial offset before we actually have a source map
         (create-index-map
           state
-          (io/file public-dir "src" (str (clojure.core/name name) ".js.index-map"))
+          (io/file public-dir "src" (str (clojure.core/name name) "-index.js.map"))
           (line-count (slurp target))
           mod)
 
         (doseq [src-name sources
                 :let [{:keys [output name js-name] :as rc} (get-in state [:sources src-name])]]
           (append-to-target (str "// SOURCE=" name "\n"))
-          (append-to-target (str (str/trim output) "\n"))
           ;; pretend we actually loaded a separate file, live-reload needs this
           (append-to-target (str "goog.dependencies_.written[" (pr-str js-name) "] = true;\n"))
+          (append-to-target (str (str/trim output) "\n"))
           )
 
         (append-to-target append-js)
         (append-to-target (str "\n\nSHADOW_MODULES[" (pr-str (str name)) "] = true;\n"))
 
-        (append-to-target (str "//# sourceMappingURL=src/" (clojure.core/name name) ".js.index-map?r=" (rand)))
+        (append-to-target (str "//# sourceMappingURL=src/" (clojure.core/name name) "-index.js.map?r=" (rand)))
         )))
 
 

            [loom.alg :as la]
            [cognitect.transit :as transit]
            [shadow.cljs.util :as util]
    ;; [clojure.pprint :refer (pprint)]
            ))

(defn ^com.google.javascript.jscomp.Compiler make-closure-compiler []

            (let [{:keys [type output js-name] :as rc} (get-in state [:sources src-name])]
              (let [lc (line-count output)
                    start-line (:current-offset src-map)
                    ;; extra 2 lines per file
                    ;; // SOURCE comment
                    ;; goog.dependencies_.written[src] = true;
                    src-map (update src-map :current-offset + lc 2)]
                (if (= :cljs type)
                  (update src-map :sections conj {:offset {:line (+ start-line 3) :column 0}
                                                  :url (str js-name ".map")})
                  ;; only have source-maps for cljs
                  src-map)
                )))
          {:current-offset init-offset
           :version 3
           :file (str "../" js-name)
           :sections []}
          sources)

        index-map (dissoc index-map :current-offset)]

    ;; (pprint index-map)
    (spit out-file (json/write-str index-map))
    ))

