Safari bug runs module worker entry files twice, breaking apps that rely on shared state
Developers building Oh So Video, a browser-based video processing tool, discovered a Safari bug where a module worker's entry file executes twice if any imported module references it. This causes each execution to maintain separate state, meaning registrations or data stored in one instance are invisible to the other. The issue reproduces consistently in Safari 18.5 across multiple import patterns — including static cycles and lazily loaded chunks — but does not occur in Chrome or Firefox. The root cause appears to be Safari treating the worker's own entry URL as absent from the module map, causing it to fetch and run the script afresh instead of returning the already-loaded module. The bug has been confirmed across Safari versions dating back to at least 18.3 and has been reported to WebKit.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in