|
38 | 38 | from reflex.compiler import templates |
39 | 39 | from reflex.config import Config, environment, get_config |
40 | 40 | from reflex.utils import console, net, path_ops, processes |
| 41 | +from reflex.utils.decorator import once |
41 | 42 | from reflex.utils.exceptions import ( |
42 | 43 | GeneratedCodeHasNoFunctionDefsError, |
43 | 44 | SystemPackageMissingError, |
@@ -987,16 +988,21 @@ def initialize_web_directory(): |
987 | 988 | init_reflex_json(project_hash=project_hash) |
988 | 989 |
|
989 | 990 |
|
| 991 | +@once |
990 | 992 | def _turbopack_flag() -> str: |
991 | 993 | return " --turbopack" if environment.REFLEX_USE_TURBOPACK.get() else "" |
992 | 994 |
|
993 | 995 |
|
994 | 996 | def _compile_package_json(): |
995 | 997 | return templates.PACKAGE_JSON.render( |
996 | 998 | scripts={ |
997 | | - "dev": constants.PackageJson.Commands.DEV + _turbopack_flag(), |
998 | | - "export": constants.PackageJson.Commands.EXPORT, |
999 | | - "export_sitemap": constants.PackageJson.Commands.EXPORT_SITEMAP, |
| 999 | + "dev": constants.PackageJson.Commands.DEV.format(flags=_turbopack_flag()), |
| 1000 | + "export": constants.PackageJson.Commands.EXPORT.format( |
| 1001 | + flags=_turbopack_flag() |
| 1002 | + ), |
| 1003 | + "export_sitemap": constants.PackageJson.Commands.EXPORT_SITEMAP.format( |
| 1004 | + flags=_turbopack_flag() |
| 1005 | + ), |
1000 | 1006 | "prod": constants.PackageJson.Commands.PROD, |
1001 | 1007 | }, |
1002 | 1008 | dependencies=constants.PackageJson.DEPENDENCIES, |
|
0 commit comments