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:
@@ -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>`)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user