Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
fix fallback fetch resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
twlite committed Apr 29, 2022
1 parent b7ffbd3 commit 39797f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deno_doc",
"version": "0.1.2",
"version": "0.1.3",
"description": "Deno doc generator for node.js",
"main": "./src/index.cjs",
"type": "module",
Expand Down
5 changes: 4 additions & 1 deletion src/utils/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export default async function tryGetFetch() {

// fallback
for (const mod of ["undici", "node-fetch"]) {
return import(mod).then(res => res.fetch || res.default || res);
try {
const _mod = await import(mod).then(res => res.fetch || res.default || res);
return _mod;
} catch {}
}

throw new Error("Could not resolve fetch api");
Expand Down

0 comments on commit 39797f0

Please sign in to comment.