Skip to content

Commit

Permalink
fix(importExternal): 导入Promise不返回
Browse files Browse the repository at this point in the history
  • Loading branch information
KotoriK committed Oct 31, 2023
1 parent 024f2c5 commit 0ce904b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/npmLib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export const importExternal = (path: string, packageName: string, version?: stri
script.src = resolvePath(path, packageName, version)
script.async = true
//TODO: 超时处理
return new Promise((resolve, reject) => {
script.onload = () => resolve
return new Promise<void>((resolve, reject) => {
script.onload = () => resolve()
script.onerror = () => {
script.remove() // 允许下次尝试
reject(new Error(packageName + "加载失败"))
Expand Down

0 comments on commit 0ce904b

Please sign in to comment.