Understand the iframe-worker injection mechanism
mainIn Chef apps, the Vite server injects code during development to allow an app running inside an iframe to listen to postMessage messages from its parent Chef window.
The injected code performs two steps:
- Verifies that the incoming message is from the parent Chef window.
- Loads a response script from
https://chef.convex.dev/scripts/worker.bundled.mjsto handle the message.
This mechanism allows Chef to manage dependencies and updates for the worker script independently of the user's application code.