Skip to content

Commit

Permalink
fix: added catch when loading js with import(...) (#328)
Browse files Browse the repository at this point in the history
Co-authored-by: Bartłomiej Piura <bartlomiej.piura@softiq.pl>
  • Loading branch information
Somft and Bartłomiej Piura committed Jan 28, 2023
1 parent 870e9d3 commit 97ed8f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/lib/src/dev/remote-development.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async function __federation_method_ensure(remoteId) {
});
} else if (importTypes.includes(remote.format)) {
// loading js with import(...)
return new Promise(resolve => {
return new Promise((resolve, reject) => {
const getUrl = typeof remote.url === 'function' ? remote.url : () => Promise.resolve(remote.url);
getUrl().then(url => {
import(/* @vite-ignore */ url).then(lib => {
Expand All @@ -107,7 +107,7 @@ async function __federation_method_ensure(remoteId) {
remote.inited = true;
}
resolve(remote.lib);
})
}).catch(reject)
})
})
}
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/src/prod/remote-production.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async function __federation_method_ensure(remoteId) {
});
} else if (importTypes.includes(remote.format)) {
// loading js with import(...)
return new Promise(resolve => {
return new Promise((resolve, reject) => {
const getUrl = typeof remote.url === 'function' ? remote.url : () => Promise.resolve(remote.url);
getUrl().then(url => {
import(/* @vite-ignore */ url).then(lib => {
Expand All @@ -112,7 +112,7 @@ async function __federation_method_ensure(remoteId) {
remote.inited = true;
}
resolve(remote.lib);
})
}).catch(reject)
})
})
}
Expand Down

0 comments on commit 97ed8f7

Please sign in to comment.