 (defun jetpack-compile-file (file)
   "Compile a file using Jetpack and show compilation results."
   (interactive "fJetpack: ")
-  (let ((default-directory (locate-dominating-file file "jetpack.json")))
+  (let ((default-directory (jetpack--project-root file)))
     (compilation-start
      (concat "/usr/bin/npx jetpack " (file-relative-name file))
      'elm-compilation-mode

            (if (string-match-p "\.js$" current-file) current-file))
        jetpack-last-compiled)))

(defun jetpack-action (file)
  "Helper function to compile file and save last-compiled."
  (setq jetpack-last-compiled file)

(defun jetpack-compile ()
  "Complete entrypoint and compile with Jetpack."
  (interactive)
  (let ((root-dir (jetpack--project-root)))
    (if root-dir
        (let* ((default-directory root-dir)
               (json-object-type 'hash-table)
