Description
A page containing a Recharts chart renders completely blank on a direct/full page load, with require_isUnsafeProperty is not a function in the browser console. The cause is the Vite 8.0.12 version Reflex 0.9.x pins; its dependency optimizer miscompiles the Recharts bundle. Downgrading to Vite 7.3.3 fixes it.
Describe the bug
A page containing a Recharts chart (e.g. rx.recharts.bar_chart) renders completely blank on a direct/full page load. The browser console shows:
Uncaught TypeError: require_isUnsafeProperty is not a function
The cause is the Vite 8.0.12 version that Reflex 0.9.x pins: its dependency optimizer miscompiles the Recharts bundle (via Recharts' es-toolkit dependency). Switching to Vite 7.3.3 fixes it immediately.
To Reproduce
Minimal example — just two files:
rxconfig.py
import reflex as rx
config = rx.Config(app_name="vite8_recharts_repro")
vite8_recharts_repro/vite8_recharts_repro.py
import reflex as rx
class State(rx.State):
data: list[dict] = [
{"name": "A", "value": 10},
{"name": "B", "value": 30},
{"name": "C", "value": 20},
]
@rx.page(route="/chart")
def chart_page() -> rx.Component:
return rx.recharts.bar_chart(
rx.recharts.bar(data_key="value"),
rx.recharts.x_axis(data_key="name"),
data=State.data,
width=400,
height=300,
)
app = rx.App()
Steps:
reflex run
- In the browser, open
http://localhost:3000/chart directly (full page load, not via in-app navigation).
- → Blank page; console shows
require_isUnsafeProperty is not a function.
Counter-test (confirms Vite is the cause):
# Set "vite" to "7.3.3" in .web/package.json, then:
cd .web && rm -rf node_modules/.vite && bun install && cd ..
reflex run
→ /chart now renders the chart correctly.
Note: A plain bun add vite@7.3.3 doesn't stick, because reflex run regenerates .web/package.json and resets Vite back to 8.0.12 (pinned in reflex_base/constants/installer.py).
- Code/Link to Repo: (minimal repro above — happy to provide a repo if needed)
Expected behavior
/chart displays the bar chart — including on a direct/full page load.
Screenshots
Blank page with console error require_isUnsafeProperty is not a function (Vite 8.0.12) vs. correctly rendered chart (Vite 7.3.3).
Specifics (please complete the following information):
- Python Version: 3.14
- Reflex Version: 0.9.3
- OS: macOS (Darwin 24.6.0, Apple Silicon)
- Browser (Optional): Safari 26.2 (also reproducible in Chrome)
Additional context
The Vite 8.0.12 optimizer produces a broken line in the Recharts bundle where a variable ends up calling itself:
// vite 8.0.12 (broken):
var require_isUnsafeProperty = require_isUnsafeProperty(); // calls itself → undefined → "is not a function"
// vite 7.3.3 (correct):
var require_isUnsafeProperty2 = require_isUnsafeProperty(); // distinct name, works
Suggested workaround: temporarily pin Vite to < 8 (e.g. 7.3.3) until the optimizer bug is fixed.
Description
A page containing a Recharts chart renders completely blank on a direct/full page load, with
require_isUnsafeProperty is not a functionin the browser console. The cause is the Vite 8.0.12 version Reflex 0.9.x pins; its dependency optimizer miscompiles the Recharts bundle. Downgrading to Vite 7.3.3 fixes it.Describe the bug
A page containing a Recharts chart (e.g.
rx.recharts.bar_chart) renders completely blank on a direct/full page load. The browser console shows:The cause is the Vite 8.0.12 version that Reflex 0.9.x pins: its dependency optimizer miscompiles the Recharts bundle (via Recharts'
es-toolkitdependency). Switching to Vite 7.3.3 fixes it immediately.To Reproduce
Minimal example — just two files:
rxconfig.pyvite8_recharts_repro/vite8_recharts_repro.pySteps:
reflex runhttp://localhost:3000/chartdirectly (full page load, not via in-app navigation).require_isUnsafeProperty is not a function.Counter-test (confirms Vite is the cause):
→
/chartnow renders the chart correctly.Expected behavior
/chartdisplays the bar chart — including on a direct/full page load.Screenshots
Blank page with console error
require_isUnsafeProperty is not a function(Vite 8.0.12) vs. correctly rendered chart (Vite 7.3.3).Specifics (please complete the following information):
Additional context
The Vite 8.0.12 optimizer produces a broken line in the Recharts bundle where a variable ends up calling itself:
Suggested workaround: temporarily pin Vite to
< 8(e.g. 7.3.3) until the optimizer bug is fixed.