             (do (io/make-parents cache-index-file)
                 {}))
 
+        cache-options
+        (->> cache-affecting-options
+             (map #(get-in state %))
+             (into []))
+
         cache-files
-        (if (not= SHADOW-CACHE-KEY (:SHADOW-CACHE-KEY cache-index))
+        (if (or (not= SHADOW-CACHE-KEY (:SHADOW-CACHE-KEY cache-index))
+                (not= cache-options (:CACHE-OPTIONS cache-index)))
           ;; invalidate all cache when the timestamp of this file has changed
           []
           ;; compare each cache key

                  (cache/write-file cache-file output)

                  (assoc idx resource-id cache-key)))
              (assoc cache-index :SHADOW-CACHE-KEY SHADOW-CACHE-KEY)
              recompile-sources)))]

    (when need-compile?

            (do (io/make-parents cache-index-file)
                {}))

        cache-options
        (->> cache-affecting-options
             (map #(get-in state %))
             (into []))

        cache-files
        (if (or (not= SHADOW-CACHE-KEY (:SHADOW-CACHE-KEY cache-index))
                (not= cache-options (:CACHE-OPTIONS cache-index)))
          ;; invalidate all cache when the timestamp of this file has changed
          []
          ;; compare each cache key
