Skip to content

Commit

Permalink
fix: try catch dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Aug 23, 2024
1 parent 2085ae5 commit 70b10f5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,16 @@ export async function lazyLoad(name, selector, callback) {
}

export async function dependency(name, promise) {
let component = await promise;
if (!window.CoCreate)
window.CoCreate = {}
try {
let component = await promise;
if (!window.CoCreate)
window.CoCreate = {}

window.CoCreate[name] = component.default || component
dispatchComponentLoaded(name)
window.CoCreate[name] = component.default || component
dispatchComponentLoaded(name)
} catch (error) {
console.error('error loading chunck: ', error)
}
}

function dispatchComponentLoaded(name) {
Expand Down

0 comments on commit 70b10f5

Please sign in to comment.