Vite + Antd App works on Windows but Single Page crashes on Linux Production (Minified React Error #130)
Source: Dev.to
Issue
I have a React application (Vite + Ant Design) deployed on Nginx (Linux). The application works perfectly in my local environment (Windows) and usually runs fine in production.
The entire app works correctly until I navigate to one specific route (MachinesDashboard).
- Windows (local & prod build): the page loads perfectly.
- Linux (Nginx production): clicking this route immediately crashes the page with an error‑boundary screen.
Error
Minified React error #130: Element type is invalid: expected a string (for built‑in components) or a class/function (for composite components) but got: object.
Debugging So Far
I suspected an invalid import, so I added console.log statements inside the crashing component (MachinesDashboard) in the production build to inspect the imports.
Imports in the crashing file
import { Select, Badge, Button, Statistic, Row, Col, message, Modal } from 'antd';
The logged values were:
| Import | Type | Valid? |
|---|---|---|
EChart | Function | ✅ |
DraftDetails | Function | ✅ |
CoreTable | Function | ✅ |
Icon | Function | ✅ |
ClockCircleOutlined | Object ({ $$typeof: Symbol(react.forward_ref), ... }) | ✅ |
All custom components and the Ant Design icons appear to be valid.
Question
Since all my custom components and the icons seem valid, why does this specific route crash only on Linux?
Possible causes I’m considering
- Ant Design imports – Could destructured imports like
import { Row, Col } from 'antd'resolve to an empty object/module in Linux production builds? - File‑system case sensitivity – My file names (
DraftDetails.tsx,ECharts.tsx) match their imports, but could a mismatched folder name cause an import to be an object without throwing a 404 on a case‑sensitive Linux file system? - Cyclic dependencies – Might a circular dependency behave differently on Linux (due to file sorting) causing a component to be undefined/object at render time?
Environment
- React: 18
- Vite: 4
- Host: Linux Ubuntu + Nginx
- Build:
vite build