Skip to content

Commit

Permalink
fix(node) add Promise.try polyfill to fix error with Node (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
aralroca authored Dec 1, 2024
1 parent 8765288 commit f7e72d2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/brisa/src/cli/serve/node-serve/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ if (!Promise.withResolvers) {
return { promise, resolve, reject };
};
}

// @ts-ignore
if (!Promise.try) {
// @ts-ignore
Promise.try = (fn) => {
try {
return Promise.resolve(fn());
} catch (e) {
return Promise.reject(e);
}
};
}

0 comments on commit f7e72d2

Please sign in to comment.