Browse Source

expose NEXTJS_VERSION and upgrade nextjs (#5039)

* expose NEXTJS_VERSION and upgrade nextjs

* disable turbopack

* Add next_dev_indicators config knob, default to False

The nextjs dev indicator might be useful in some circumstances, but it also can
block elements that we want to click for integration tests. Since it's a new
feature, disable it until we find that it's useful -- otherwise it's just
branding for Vercel.

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
Khaleel Al-Adhami 1 month ago
parent
commit
7a2ec85a9f

+ 4 - 1
reflex/config.py

@@ -703,7 +703,7 @@ class EnvironmentVariables:
     REFLEX_STATE_SIZE_LIMIT: EnvVar[int] = env_var(1000)
     REFLEX_STATE_SIZE_LIMIT: EnvVar[int] = env_var(1000)
 
 
     # Whether to use the turbopack bundler.
     # Whether to use the turbopack bundler.
-    REFLEX_USE_TURBOPACK: EnvVar[bool] = env_var(True)
+    REFLEX_USE_TURBOPACK: EnvVar[bool] = env_var(False)
 
 
     # Additional paths to include in the hot reload. Separated by a colon.
     # Additional paths to include in the hot reload. Separated by a colon.
     REFLEX_HOT_RELOAD_INCLUDE_PATHS: EnvVar[list[Path]] = env_var([])
     REFLEX_HOT_RELOAD_INCLUDE_PATHS: EnvVar[list[Path]] = env_var([])
@@ -826,6 +826,9 @@ class Config(Base):
     # Whether to enable or disable nextJS gzip compression.
     # Whether to enable or disable nextJS gzip compression.
     next_compression: bool = True
     next_compression: bool = True
 
 
+    # Whether to enable or disable NextJS dev indicator.
+    next_dev_indicators: bool = False
+
     # Whether to use React strict mode in nextJS
     # Whether to use React strict mode in nextJS
     react_strict_mode: bool = True
     react_strict_mode: bool = True
 
 

+ 2 - 1
reflex/constants/installer.py

@@ -2,6 +2,7 @@
 
 
 from __future__ import annotations
 from __future__ import annotations
 
 
+import os
 from types import SimpleNamespace
 from types import SimpleNamespace
 
 
 from .base import IS_WINDOWS
 from .base import IS_WINDOWS
@@ -84,7 +85,7 @@ class PackageJson(SimpleNamespace):
         "@emotion/react": "11.14.0",
         "@emotion/react": "11.14.0",
         "axios": "1.8.3",
         "axios": "1.8.3",
         "json5": "2.2.3",
         "json5": "2.2.3",
-        "next": "15.0.4",
+        "next": os.getenv("NEXTJS_VERSION", "15.2.4"),
         "next-sitemap": "4.2.3",
         "next-sitemap": "4.2.3",
         "next-themes": "0.4.6",
         "next-themes": "0.4.6",
         "react": "19.0.0",
         "react": "19.0.0",

+ 1 - 0
reflex/utils/prerequisites.py

@@ -1067,6 +1067,7 @@ def _update_next_config(
         "compress": config.next_compression,
         "compress": config.next_compression,
         "trailingSlash": True,
         "trailingSlash": True,
         "staticPageGenerationTimeout": config.static_page_generation_timeout,
         "staticPageGenerationTimeout": config.static_page_generation_timeout,
+        "devIndicators": config.next_dev_indicators,
     }
     }
     if transpile_packages:
     if transpile_packages:
         next_config["transpilePackages"] = list(
         next_config["transpilePackages"] = list(

+ 14 - 6
tests/units/test_prerequisites.py

@@ -32,7 +32,7 @@ runner = CliRunner()
                 app_name="test",
                 app_name="test",
             ),
             ),
             False,
             False,
-            'module.exports = {basePath: "", compress: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
+            'module.exports = {basePath: "", compress: true, trailingSlash: true, staticPageGenerationTimeout: 60, devIndicators: false};',
         ),
         ),
         (
         (
             Config(
             Config(
@@ -40,7 +40,7 @@ runner = CliRunner()
                 static_page_generation_timeout=30,
                 static_page_generation_timeout=30,
             ),
             ),
             False,
             False,
-            'module.exports = {basePath: "", compress: true, trailingSlash: true, staticPageGenerationTimeout: 30};',
+            'module.exports = {basePath: "", compress: true, trailingSlash: true, staticPageGenerationTimeout: 30, devIndicators: false};',
         ),
         ),
         (
         (
             Config(
             Config(
@@ -48,7 +48,7 @@ runner = CliRunner()
                 next_compression=False,
                 next_compression=False,
             ),
             ),
             False,
             False,
-            'module.exports = {basePath: "", compress: false, trailingSlash: true, staticPageGenerationTimeout: 60};',
+            'module.exports = {basePath: "", compress: false, trailingSlash: true, staticPageGenerationTimeout: 60, devIndicators: false};',
         ),
         ),
         (
         (
             Config(
             Config(
@@ -56,7 +56,7 @@ runner = CliRunner()
                 frontend_path="/test",
                 frontend_path="/test",
             ),
             ),
             False,
             False,
-            'module.exports = {basePath: "/test", compress: true, trailingSlash: true, staticPageGenerationTimeout: 60};',
+            'module.exports = {basePath: "/test", compress: true, trailingSlash: true, staticPageGenerationTimeout: 60, devIndicators: false};',
         ),
         ),
         (
         (
             Config(
             Config(
@@ -65,14 +65,22 @@ runner = CliRunner()
                 next_compression=False,
                 next_compression=False,
             ),
             ),
             False,
             False,
-            'module.exports = {basePath: "/test", compress: false, trailingSlash: true, staticPageGenerationTimeout: 60};',
+            'module.exports = {basePath: "/test", compress: false, trailingSlash: true, staticPageGenerationTimeout: 60, devIndicators: false};',
         ),
         ),
         (
         (
             Config(
             Config(
                 app_name="test",
                 app_name="test",
             ),
             ),
             True,
             True,
-            'module.exports = {basePath: "", compress: true, trailingSlash: true, staticPageGenerationTimeout: 60, output: "export", distDir: "_static"};',
+            'module.exports = {basePath: "", compress: true, trailingSlash: true, staticPageGenerationTimeout: 60, devIndicators: false, output: "export", distDir: "_static"};',
+        ),
+        (
+            Config(
+                app_name="test",
+                next_dev_indicators=True,
+            ),
+            True,
+            'module.exports = {basePath: "", compress: true, trailingSlash: true, staticPageGenerationTimeout: 60, devIndicators: true, output: "export", distDir: "_static"};',
         ),
         ),
     ],
     ],
 )
 )