fix(export): keep zips written to --zip-dest-dir out of backend.zip

SH
1d ago
+100-5

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Description

Exporting to a folder inside the app puts frontend.zip in backend.zip, and a second export there makes backend.zip archive itself:

$ reflex init --template blank
$ mkdir dist
$ reflex export --zip-dest-dir dist
$ unzip -l dist/backend.zip | grep zip
Archive:  dist/backend.zip
   667646  11-26-2026 23:35   dist/frontend.zip
$ reflex export --zip-dest-dir dist

I stopped the second export after 20 s, at 525 MB. It keeps going until the disk is full. Without the mkdir, the export fails at the end with a FileNotFoundError for dist/frontend.zip. 0.11.0 behaves the same.

zip_app only left out the zips in the current directory. It now also leaves out the ones in zip_dest_dir, by file identity like the rest of the walk, and creates that folder if it's missing. The .web/backend files were checked by name against a set of paths, which never matched, so they get the same check, and --exclude-from-backend now works for them.

I didn't skip every zip in the app: old zips in dist/ still go into an export to out/, like any other file.

Without the fix, 7 of the new test cases fail. A plain reflex export writes byte-identical zips with and without it.