From de523d08f488f076df08cd7d0f72c69adfc57d35 Mon Sep 17 00:00:00 2001 From: Sped0n Date: Sat, 4 Nov 2023 14:25:33 +0800 Subject: [PATCH] fix(main.ts): change import statements to use import then syntax instead of top layer await to improve compatibility with Firefox and Chromium browsers --- assets/ts/main.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/ts/main.ts b/assets/ts/main.ts index 4c4f9b7..ae1302d 100644 --- a/assets/ts/main.ts +++ b/assets/ts/main.ts @@ -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)) } }