Skip to content

Commit 69e6d8f

Browse files
authored
fix(bundling): throw error if download fails (#253)
1 parent bf65cd5 commit 69e6d8f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/assets.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ export function setupPublicAssetStrategy(options: ModuleOptions['assets'] = {})
106106
let encoding
107107
let size = 0
108108
res = await fetch(url).then((r) => {
109+
if (!r.ok) {
110+
throw new Error(`@nuxt/scripts - Failed to download script: ${url}. ${r.statusText} (${r.status})`)
111+
}
109112
encoding = r.headers.get('content-encoding')
110113
const contentLength = r.headers.get('content-length')
111114
size = contentLength ? Number(contentLength) / 1024 : 0

0 commit comments

Comments
 (0)