fix(main.ts): change import statements to use import then syntax instead of top layer await to improve compatibility with Firefox and Chromium browsers

This commit is contained in:
Sped0n
2023-11-04 14:25:33 +08:00
parent fdc00ce22c
commit de523d08f4

View File

@@ -9,12 +9,14 @@ const ijs = initResources()
initState(ijs.length)
initNav()
// NOTE: it seems firefox and chromnium don't like top layer await
// so we are using import then instead
if (ijs.length > 0) {
if (!isMobile()) {
const d = await import('./desktop/init')
d.initDesktop(ijs)
import('./desktop/init')
.then((d) => d.initDesktop(ijs))
.catch((e) => console.log(e))
} else {
const m = await import('./mobile/init')
m.initMobile(ijs)
import('./mobile/init').then((m) => m.initMobile(ijs)).catch((e) => console.log(e))
}
}