Fix iOS WebKit crash by shipping external app.js instead of inlined HTML.

Stop embedding the 1.4MB bundle in index.html to avoid std::overflow_error on launch, validate the iOS asset build, and surface load failures in the native shell.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-06-06 21:53:26 +08:00
parent d9d97552c8
commit db5465c646
5 changed files with 87 additions and 143 deletions
+5 -2
View File
@@ -36,8 +36,11 @@ window.__WORDLOOP_RUNTIME__ = {
const withoutModule = html
.replace(/\s+crossorigin(="[^"]*")?/g, '')
.replace('<script type="module"', '<script')
.replace(/\.\/assets\//g, 'wordloop://app/assets/')
return withoutModule.replace('<script src=', `${bootstrap}\n <script src=`)
const withBootstrap = withoutModule.replace('<script src=', `${bootstrap}\n <script src=`)
const scriptTag = withBootstrap.match(/<script src="\.\/assets\/[^"]+"><\/script>/)
if (!scriptTag) return withBootstrap
const withoutHeadScript = withBootstrap.replace(scriptTag[0], '')
return withoutHeadScript.replace('</body>', ` ${scriptTag[0]}\n </body>`)
},
}
}