make turbopack depends on env var
This commit is contained in:
parent
30694c6a96
commit
5784533f5f
@ -567,6 +567,9 @@ class EnvironmentVariables:
|
|||||||
# The maximum size of the reflex state in kilobytes.
|
# The maximum size of the reflex state in kilobytes.
|
||||||
REFLEX_STATE_SIZE_LIMIT: EnvVar[int] = env_var(1000)
|
REFLEX_STATE_SIZE_LIMIT: EnvVar[int] = env_var(1000)
|
||||||
|
|
||||||
|
# Whether to use the turbopack bundler.
|
||||||
|
REFLEX_USE_TURBOPACK: EnvVar[bool] = env_var(True)
|
||||||
|
|
||||||
|
|
||||||
environment = EnvironmentVariables()
|
environment = EnvironmentVariables()
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ class PackageJson(SimpleNamespace):
|
|||||||
class Commands(SimpleNamespace):
|
class Commands(SimpleNamespace):
|
||||||
"""The commands to define in package.json."""
|
"""The commands to define in package.json."""
|
||||||
|
|
||||||
DEV = "next dev --turbopack"
|
DEV = "next dev"
|
||||||
EXPORT = "next build"
|
EXPORT = "next build"
|
||||||
EXPORT_SITEMAP = "next build && next-sitemap"
|
EXPORT_SITEMAP = "next build && next-sitemap"
|
||||||
PROD = "next start"
|
PROD = "next start"
|
||||||
|
@ -610,10 +610,14 @@ def initialize_web_directory():
|
|||||||
init_reflex_json(project_hash=project_hash)
|
init_reflex_json(project_hash=project_hash)
|
||||||
|
|
||||||
|
|
||||||
|
def _turbopack_flag() -> str:
|
||||||
|
return " --turbopack" if environment.REFLEX_USE_TURBOPACK.get() else ""
|
||||||
|
|
||||||
|
|
||||||
def _compile_package_json():
|
def _compile_package_json():
|
||||||
return templates.PACKAGE_JSON.render(
|
return templates.PACKAGE_JSON.render(
|
||||||
scripts={
|
scripts={
|
||||||
"dev": constants.PackageJson.Commands.DEV,
|
"dev": constants.PackageJson.Commands.DEV + _turbopack_flag(),
|
||||||
"export": constants.PackageJson.Commands.EXPORT,
|
"export": constants.PackageJson.Commands.EXPORT,
|
||||||
"export_sitemap": constants.PackageJson.Commands.EXPORT_SITEMAP,
|
"export_sitemap": constants.PackageJson.Commands.EXPORT_SITEMAP,
|
||||||
"prod": constants.PackageJson.Commands.PROD,
|
"prod": constants.PackageJson.Commands.PROD,
|
||||||
|
Loading…
Reference in New Issue
Block a user