diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts index dfa77325908d..aa1f04aa2701 100644 --- a/packages/astro/src/transitions/router.ts +++ b/packages/astro/src/transitions/router.ts @@ -131,7 +131,7 @@ function runScripts() { // inline module scripts cannot be awaited for with onload. // Thus to be able to wait for the execution of all scripts, we make sure that the last inline module script // is always followed by an external module script - for (const script of document.getElementsByTagName('script')) { + for (const script of Array.from(document.getElementsByTagName('script'))) { script.dataset.astroExec === undefined && script.getAttribute('type') === 'module' && (needsWaitForInlineModuleScript = script.getAttribute('src') === null); @@ -142,7 +142,7 @@ function runScripts() { `