Commit a03f3c2
committed
fix: resolve React forwardRef error in production builds by using classic JSX runtime
Root Cause:
- @iconify/react internally uses React.forwardRef
- Vite's automatic JSX runtime caused React to be tree-shaken in production
- This resulted in 'Cannot read properties of undefined (reading forwardRef)' error
Solution:
1. Configure @vitejs/plugin-react to use classic JSX runtime in vite.config.ts
2. Update buildIcons.js to add 'import * as React' in generated icons.tsx
3. Fix server start script to use bun --env-file directly
4. Add production server start script with public folder copy
Changes:
- app/vite.config.ts: Added jsxRuntime: 'classic' to React plugin config
- app/src/components/Common/Iconify/buildIcons.js: Added React import to template
- app/src/components/Common/Iconify/icons.tsx: Regenerated with React import
- server/package.json: Fixed start script to use bun --env-file
- package.json: Added start:server:production script with ncp copy
- .gitignore: Added server/public to ignore list1 parent cb35b92 commit a03f3c2
File tree
6 files changed
+6
-14
lines changed- app
- src/components/Common/Iconify
- server
6 files changed
+6
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | 12 | | |
16 | 13 | | |
17 | 14 | | |
| |||
98 | 95 | | |
99 | 96 | | |
100 | 97 | | |
101 | | - | |
102 | | - | |
103 | 98 | | |
104 | 99 | | |
105 | 100 | | |
| |||
122 | 117 | | |
123 | 118 | | |
124 | 119 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | 120 | | |
132 | 121 | | |
133 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
0 commit comments