pierrejeambrun opened a new pull request, #67546: URL: https://github.com/apache/airflow/pull/67546
Follow-up to #67352. In production builds, the Monaco editor was unable to spawn its web workers — Chrome logged `Could not create web worker(s). Falling back to loading web worker code in main thread.` plus MIME-type errors for `editor/editor.worker.js`, and the JSON editor in XComs / Audit Log was running everything (syntax service, folding) on the UI thread. ### Root cause #67352 switched the worker imports from `?worker` to `?url` so a Blob shim could re-import them same-origin. `?url`, however, does **not** run Vite's worker pipeline: - For `editor.worker.js` (the entry source is ~1 KB), `?url` inlines the **raw** module as a base64 data URL via `build.assetsInlineLimit`. The inlined module still contains bare-specifier imports (`vs/editor/...`) that cannot be resolved inside a module Worker. - For `json.worker.js` it copies a partly-bundled file whose top-level `import '../../editor/editor.worker.js'` resolves to a path that does not exist in the build output. In both cases the Worker fails to evaluate, Monaco's fallback path kicks in, and the unhashed `editor/editor.worker.js` URL Monaco tries next hits the SPA HTML fallback (the MIME error). ### Fix Switch the imports to `?worker&url`. Vite's worker plugin runs the file through the full worker pipeline (bundling all dependencies into a self-contained IIFE), and the `&url` suffix returns the bundled file's URL as a string instead of a Worker constructor — which is what the Blob shim needs. Verified the rebuilt `dist/` now contains self-contained workers (`editor.worker-<hash>.js` ≈ 260 KB, `json.worker-<hash>.js` ≈ 390 KB, zero top-level imports), with small URL-wrapper modules pointing at them. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Opus 4.7) Generated-by: Claude Code (Opus 4.7) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
