From 44f560b453fe1161cc6e1dcad6e48fd0ac812cd4 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 14 Jul 2022 22:25:57 +0900 Subject: [PATCH] tweak boot.js --- packages/backend/src/server/web/boot.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/web/boot.js b/packages/backend/src/server/web/boot.js index b9f00bb21d..9570115423 100644 --- a/packages/backend/src/server/web/boot.js +++ b/packages/backend/src/server/web/boot.js @@ -56,14 +56,23 @@ //#endregion //#region Script - window.addEventListener('DOMContentLoaded', () => { + function importAppScript() { import(`/assets/${CLIENT_ENTRY}`) .catch(async e => { await checkUpdate(); console.error(e); renderError('APP_IMPORT', e); }); - }); + } + + // タイミングによっては、この時点でDOMの構築が済んでいる場合とそうでない場合とがある + if (document.readyState !== 'loading') { + importAppScript(); + } else { + window.addEventListener('DOMContentLoaded', () => { + importAppScript(); + }); + } //#endregion //#region Theme