Commit 4536297
committed
fix(runtime): replace broken React UMD vendor + unblock JSX previews
The shipped `packages/runtime/vendor/{react,react-dom}.umd.js` were broken
builds containing `if (n) let g = !0;` — invalid JS that V8 rejects with
"Lexical declaration cannot appear in a single-statement context". Every
JSX-era design therefore failed to execute inside the preview iframe:
React never defined `window.ReactDOM`, Babel then raised
`ReferenceError: ReactDOM is not defined`, and the hub thumbnails + main
PreviewPane showed as blank / "brokenJsx".
- Replace vendor with clean React 18.3.1 production UMDs from unpkg
(react 10.7 KB, react-dom 131.8 KB).
- Scope DesignCardPreview's `transform: scale` to a wrapper div so
Chromium doesn't defer script scheduling when the iframe itself has a
heavy transform + tiny post-transform visible area.
- Add the missing i18n keys `preview.error.brokenJsx` /
`preview.error.undefinedRef` (zh-CN + en) so CanvasErrorBar surfaces
a readable message instead of the dev `⟦key⟧` fallback.1 parent 4cc21df commit 4536297
5 files changed
Lines changed: 301 additions & 8681 deletions
File tree
- apps/desktop/src/renderer/src/views/hub
- packages
- i18n/src/locales
- runtime/vendor
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
193 | 195 | | |
194 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
195 | 205 | | |
196 | 206 | | |
197 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
| |||
0 commit comments