Skip to content

Commit 70b10f5

Browse files
committed
fix: try catch dependency
1 parent 2085ae5 commit 70b10f5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/client.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ export async function lazyLoad(name, selector, callback) {
6161
}
6262

6363
export async function dependency(name, promise) {
64-
let component = await promise;
65-
if (!window.CoCreate)
66-
window.CoCreate = {}
64+
try {
65+
let component = await promise;
66+
if (!window.CoCreate)
67+
window.CoCreate = {}
6768

68-
window.CoCreate[name] = component.default || component
69-
dispatchComponentLoaded(name)
69+
window.CoCreate[name] = component.default || component
70+
dispatchComponentLoaded(name)
71+
} catch (error) {
72+
console.error('error loading chunck: ', error)
73+
}
7074
}
7175

7276
function dispatchComponentLoaded(name) {

0 commit comments

Comments
 (0)