Skip to content

Commit

Permalink
fix: reject preload promise if link fails to load (#2027)
Browse files Browse the repository at this point in the history
ref #2009
  • Loading branch information
Rich-Harris committed Feb 15, 2021
1 parent e324e36 commit f74d65d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite/src/node/plugins/importAnaysisBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ function preload(baseModule: () => Promise<{}>, deps?: string[]) {
// @ts-ignore
document.head.appendChild(link)
if (isCss) {
return new Promise((res) => {
return new Promise((res, rej) => {
link.addEventListener('load', res)
link.addEventListener('error', rej)
})
}
})
Expand Down

0 comments on commit f74d65d

Please sign in to comment.