| @@ -216,8 +216,15 @@ | ||
| 216 | 216 | 'maxHeight' => $entry['max_height'], |
| 217 | 217 | 'defaultWidth' => $entry['default_width'], |
| 218 | 218 | 'defaultHeight' => $entry['default_height'], |
| 219 | 219 | 'scriptUrl' => $script_payload['url'], |
| 220 | + // The packages this widget declares, in load order. | |
| 221 | + // WordPress resolves a script's dependencies when it | |
| 222 | + // enqueues it; a widget bundle is delivered lazily and | |
| 223 | + // never goes through that, so a widget declaring | |
| 224 | + // `wp-api-fetch` found `wp.apiFetch` undefined at mount. | |
| 225 | + // See docs/migration-wp-package-globals.md. | |
| 226 | + 'scriptDeps' => openstation_resolve_script_dependencies( $entry['script'] ), | |
| 220 | 227 | 'scriptHandle' => $entry['script'], |
| 221 | 228 | 'scriptBefore' => $script_payload['before'], |
| 222 | 229 | 'scriptAfter' => $script_payload['after'], |
| 223 | 230 | 'scriptL10n' => $script_payload['l10n'], |