           (let [file-name (-> (.getPath file)
                               (str/replace (str (System/getProperty "user.dir") "/") ""))
                 content (slurp file)
-                js-modules (some->>
-                             content
-                             (re-seq #"\(js/require \"([^\"]+)\"\)")
-                             (map last)
-                             (vec))
-                commented-modules (some->>
-                                    content
-                                    (re-seq #"[;]{2,}.*\(js/require \"([^\"]+)\"\)")
-                                    (map last)
-                                    (set))
-                js-modules (if commented-modules
-                             (vec (remove commented-modules js-modules))
-                             js-modules)]
+                js-modules (required-modules content)]
             (if js-modules
               (swap! m assoc file-name (vec js-modules))))))
       (spit path @m)

        (catch Exception e
          (println "Error: " e)))))

  ;; Each file maybe corresponds to multiple modules.
  (defn watch-for-external-modules
    []


                                  (when (.exists file)
                                    (let [content (slurp file)
                                          js-modules (required-modules content)]
                                      (let [old-js-modules (get m file-name)]
                                        (when (not= old-js-modules js-modules)
                                          (let [new-m (if (seq js-modules)
