From 77fef4ee239c8cbc25d418f0d2034a95e107486a Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 23 Apr 2022 16:32:58 +0900 Subject: [PATCH] use import --- packages/backend/src/server/web/boot.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/backend/src/server/web/boot.js b/packages/backend/src/server/web/boot.js index 43f8553abd..522a3f7d83 100644 --- a/packages/backend/src/server/web/boot.js +++ b/packages/backend/src/server/web/boot.js @@ -58,14 +58,11 @@ ? `?salt=${localStorage.getItem('salt')}` : ''; - const script = document.createElement('script'); - script.setAttribute('src', `/assets/${CLIENT_ENTRY}${salt}`); - script.setAttribute('type', 'module'); - script.addEventListener('error', async () => { - await checkUpdate(); - renderError('APP_FETCH_FAILED'); - }); - document.head.appendChild(script); + import(`/assets/${CLIENT_ENTRY}${salt}`) + .catch(async () => { + await checkUpdate(); + renderError('APP_FETCH_FAILED'); + }); //#endregion //#region Theme