Skip to content

Commit

Permalink
feat: log and re-raise error on ESM import failure (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorshea authored Apr 17, 2023
1 parent c1f5c33 commit 3032aa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/metal-llamas-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"anywidget": patch
---

feat: log an re-raise error on ESM import failure
7 changes: 6 additions & 1 deletion packages/anywidget/src/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@ async function load_esm(esm) {
let url = URL.createObjectURL(
new Blob([esm], { type: "text/javascript" }),
);
let widget = await import(/* webpackIgnore: true */ url);
try {
let widget = await import(/* webpackIgnore: true */ url);
} catch (e) {
console.log(e);
throw e;
}
URL.revokeObjectURL(url);
return widget;
}
Expand Down

0 comments on commit 3032aa5

Please sign in to comment.