Set REFLEX_ENV_MODE=prod for exports

Ensure that exported frontends use minified names

Set REFLEX_ENV_MODE earlier
This commit is contained in:
Masen Furer 2024-12-10 15:59:02 -08:00
parent 5c9839e0fe
commit 5ae1541aa9
No known key found for this signature in database
GPG Key ID: B0008AD22B3B3A95

View File

@ -316,6 +316,10 @@ def export(
),
):
"""Export the app to a zip file."""
# Set env mode in the environment
# This must be set before importing modules that contain rx.State subclasses
environment.REFLEX_ENV_MODE.set(constants.Env.PROD)
from reflex.utils import export as export_utils
from reflex.utils import prerequisites
@ -662,6 +666,10 @@ def deployv2(
),
):
"""Deploy the app to the Reflex hosting service."""
# Set env mode in the environment
# This must be set before importing modules that contain rx.State subclasses
environment.REFLEX_ENV_MODE.set(constants.Env.PROD)
from reflex_cli.v2 import cli as hosting_cli
from reflex_cli.v2.utils import dependency