You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 93b2bc6
Browse filesBrowse the repository at this point in the historyBrowse files
Revert the move of React Compiler support into a plugin
Reverts 6e6a0bb, f29fb85 and 1ec63f2. The framework has no
settled interface for plugins to update the Vite config, so keep the
react_compiler config flag for now and move it into a plugin once that
interface exists, as suggested in review.
Claude-Session: https://claude.ai/code/session_01URTf7ThCUgaCpZGXmgPo7f
Copy file name to clipboardExpand all lines: docs/advanced_onboarding/configuration.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,26 +143,26 @@ See the [plugins reference](/docs/api-reference/plugins/) for the available plug
143
143
144
144
## React Compiler (Experimental)
145
145
146
-
React Compiler adds automatic memoization to generated React components. It is disabled by default. To try it, add `ReactCompilerPlugin` to the plugins in `rxconfig.py`:
146
+
React Compiler adds automatic memoization to generated React components. It is disabled by default. To try it, set `react_compiler=True` in `rxconfig.py`:
147
147
148
148
```python
149
149
config = rx.Config(
150
150
app_name="my_app_name",
151
-
plugins=[rx.plugins.ReactCompilerPlugin()],
151
+
react_compiler=True,
152
152
)
153
153
```
154
154
155
155
Or enable it with an environment variable:
156
156
157
157
```bash
158
-
REFLEX_EXTRA_PLUGINS="reflex.plugins.ReactCompilerPlugin" uv run reflex run
158
+
REFLEX_REACT_COMPILER=true uv run reflex run
159
159
```
160
160
161
-
This plugin targets Reflex's supported React 19 runtime and runs in both development and production. It compiles generated JavaScript and JSX in `app/`, `app_components/`, and `utils/components/`. Other runtime utilities and installed dependencies are excluded. Existing Reflex memoization remains enabled.
161
+
This option targets Reflex's supported React 19 runtime and runs in both development and production. It compiles generated JavaScript and JSX in `app/`, `app_components/`, and `utils/components/`. Other runtime utilities and installed dependencies are excluded. Existing Reflex memoization remains enabled.
162
162
163
163
The compiler adds build time and memory overhead. Runtime performance depends on the workload: it can avoid repeated calculations during unrelated state updates, but list-heavy updates can become slower. Measure your application's interactions before enabling it in production.
164
164
165
-
Restart `reflex run` after adding or removing the plugin, and rebuild production output. Removing it drops the compiler transform and its build dependencies on the next frontend install, unless another plugin requires those dependencies.
165
+
Restart `reflex run` after changing the flag, and rebuild production output. Disabling the flag removes the compiler transform and its optional build dependencies on the next frontend install, unless another component or plugin requires those dependencies.
Copy file name to clipboardExpand all lines: docs/api-reference/plugins.md
-36Lines changed: 0 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,17 +109,6 @@ config = rx.Config(
109
109
)
110
110
```
111
111
112
-
### ReactCompilerPlugin
113
-
114
-
The `ReactCompilerPlugin` compiles generated components with the experimental [React Compiler](https://react.dev/learn/react-compiler), which adds automatic memoization. See [React Compiler](/docs/advanced-onboarding/configuration/#react-compiler-experimental) for its scope and performance tradeoffs.
115
-
116
-
```python
117
-
config = rx.Config(
118
-
app_name="my_app",
119
-
plugins=[rx.plugins.ReactCompilerPlugin()],
120
-
)
121
-
```
122
-
123
112
### TailwindV3Plugin
124
113
125
114
The `TailwindV3Plugin` integrates Tailwind CSS v3 into your Reflex application. While still supported, TailwindV4Plugin is recommended for new projects.
@@ -214,10 +203,6 @@ class Plugin:
214
203
"""Get paths to stylesheets required by the plugin."""
"""Get Vite plugins to add to the generated vite.config.js."""
219
-
return []
220
-
221
206
defregister_route(self, **context) -> None:
222
207
"""Contribute pages before the app's first compilation."""
223
208
pass
@@ -265,27 +250,6 @@ config = rx.Config(
265
250
)
266
251
```
267
252
268
-
### Adding Vite Plugins
269
-
270
-
A plugin can add [Vite plugins](https://vite.dev/guide/using-plugins) to the generated `vite.config.js` by returning `VitePlugin` entries from `get_vite_plugins`. Each entry imports the module's default export under a name the framework generates, so plugins never clash, and calls it with `args`, a JavaScript source string. `module` is an npm package (declare it as a frontend dependency) or a path relative to `.web`, such as a Vite plugin shipped as a static asset:
Vite plugins are placed before React Router's, in plugin configuration order. Set the Vite plugin's `enforce` property to order it relative to Vite's and React Router's own transforms.
288
-
289
253
### Contributing Pages
290
254
291
255
A plugin can contribute pages by overriding `register_route`. The hook runs
Add the experimental`rx.plugins.ReactCompilerPlugin`, which compiles generated components with React Compiler in development and production. Enable it with `plugins=[rx.plugins.ReactCompilerPlugin()]` in `rxconfig.py`.
1
+
Add an experimental, default-off `react_compiler` configuration flag to enable React Compiler memoization for generated components in development and production.
Add the experimental `ReactCompilerPlugin`, and a `Plugin.get_vite_plugins()` hook that lets plugins add Vite plugins to the generated `vite.config.js` instead of patching its text.
1
+
Add the experimental `react_compiler` configuration option, also available as `REFLEX_REACT_COMPILER`, to opt in to automatic React component memoization.
Copy file name to clipboardExpand all lines: packages/reflex-base/src/reflex_base/config.py
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -175,6 +175,7 @@ class BaseConfig:
175
175
cors_allowed_origins: Comma separated list of origins that are allowed to connect to the backend API.
176
176
vite_allowed_hosts: Allowed hosts for the Vite dev server. Set to True to allow all hosts, or provide a list of hostnames (e.g. ["myservice.local"]) to allow specific ones. Prevents 403 errors in Docker, Codespaces, reverse proxies, etc.
177
177
react_strict_mode: Whether to use React strict mode.
178
+
react_compiler: Enable experimental React Compiler memoization for generated components in development and production. Defaults to False.
178
179
frontend_compression_formats: Pre-compressed frontend asset formats to generate for production builds. Supported values are "gzip", "brotli", and "zstd". Use an empty list to disable build-time pre-compression.
179
180
frontend_packages: Additional frontend packages to install.
180
181
frontend_lazy_bundled_libraries: Load optional dynamic-component libraries when a dynamic component is first evaluated, rather than importing their full namespaces on every page. Defaults to False for compatibility with scripts that read window.__reflex directly.
0 commit comments