Skip to content

fix(desktop): strip crossorigin from built assets so macOS 12 webview loads#2883

Merged
esengine merged 1 commit into
main-v2from
fix-macos-blackscreen-crossorigin
Jun 3, 2026
Merged

fix(desktop): strip crossorigin from built assets so macOS 12 webview loads#2883
esengine merged 1 commit into
main-v2from
fix-macos-blackscreen-crossorigin

Conversation

@esengine

@esengine esengine commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Problem

Users on macOS 12.6 Intel report the downloaded desktop app launches to a black screen, while wails dev / pnpm dev runs fine on the same machine.

Root cause

Vite emits the entry script and stylesheet with a crossorigin attribute:

<script type="module" crossorigin src="./assets/index-*.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-*.css">
  • In dev, assets are served from http://127.0.0.1:5173 (a normal http origin), so the CORS-mode fetch the crossorigin attribute forces is satisfied.
  • In the packaged app, assets are served by Wails over the wails:// scheme. On the older WebKit shipped with macOS ≤ 12 (Safari 15), the crossorigin fetch over a custom scheme is treated as cross-origin and the scheme handler returns no Access-Control-Allow-Origin, so the request is blocked — the bundle never runs and only the dark window background paints, which reads as a black screen. Ventura+ WebKit tolerates it, so it only reproduces on macOS ≤ 12.

The window itself opens (hence a dark screen, not a crash or a Gatekeeper 'damaged' error), and the binary is universal + ad-hoc signed without hardened runtime, so architecture and JIT entitlements are not involved.

Fix

A tiny transformIndexHtml plugin strips the crossorigin attribute from the built index.html. Wails serves everything same-origin, so CORS is not needed and the same-origin module/stylesheet load normally.

Validation

  • tsc --noEmit + vite build clean; built index.html no longer carries crossorigin.
  • Needs a final confirmation on a macOS 12.6 machine (couldn't reproduce the old-WebKit path in CI).

… loads

Vite tags the entry module + stylesheet with crossorigin; over the wails://
scheme on Safari 15 WebKit (macOS <=12) the CORS fetch has no allow-origin and
is blocked, so the bundle never runs and the window paints blank. Same-origin
embedded assets need no CORS, so dropping the attribute restores rendering.
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 3, 2026
@esengine esengine merged commit f76129f into main-v2 Jun 3, 2026
6 checks passed
@esengine esengine deleted the fix-macos-blackscreen-crossorigin branch June 3, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant