         (message "Deleted old autoloads.el"))
       (message "Generating new autoloads.el")
       (dolist (file (mapcar #'file-truename (reverse targets)))
-        (let ((generated-autoload-load-name file))
+        (let ((generated-autoload-load-name (file-name-sans-extension file)))
           (message
            (cond ((not (doom-packages--read-if-cookies file))
                   "⚠ Ignoring %s")

      (insert ";;; -*- lexical-binding:t -*-\n"
              ";; This file was autogenerated by `doom|refresh-cache', DO NOT EDIT!\n")
      (prin1 `(setq load-path ',load-path
                    Info-directory-list ',Info-directory-list
                    doom-disabled-packages ',doom-disabled-packages
                    package-activated-list ',package-activated-list)

      ;; in case this function has side effects.
      (progn
        (doom-packages--async-run 'doom//reload-autoloads)
        (load doom-autoload-file 'noerror nil 'nosuffix))
    (let ((default-directory doom-emacs-dir)
          (targets
           (file-expand-wildcards
