You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for Promise.withResolvers() in Next.js for both the browser and Node.js environments.
Ensure compatibility with Next.js's supported browser versions, particularly Safari versions between 12 and 17.4
Chrome 64+
Edge 79+
Firefox 67+
Opera 51+
Safari 12+
Enable Promise.withResolvers() polyfill for Node.js, especially for versions before Node 22.
Ensure that Promise.withResolvers() is supported in TypeScript 5.4, which already has built-in support for this method.
Non-Goals
Support for older browsers not officially supported by Next.js.
Background
Promise.withResolvers() is a useful method that was added to the JavaScript specification and is expected to be baseline-supported by 2024, as documented in MDN. However, as of now, this feature is only supported in Node.js version 22 and above. Since Next.js supports a range of browsers starting from Chrome 64, Edge 79, Firefox 67, Opera 51, and Safari 12, a polyfill would help ensure compatibility across both browser and server environments. Adding this polyfill can smooth the transition for developers until all supported environments natively support Promise.withResolvers().
Proposal
Add the polyfill for Promise.withResolvers() in both the Next.js polyfill modules:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Goals
Promise.withResolvers()
in Next.js for both the browser and Node.js environments.Promise.withResolvers()
polyfill for Node.js, especially for versions before Node 22.Non-Goals
Background
Promise.withResolvers()
is a useful method that was added to the JavaScript specification and is expected to be baseline-supported by 2024, as documented in MDN. However, as of now, this feature is only supported in Node.js version 22 and above. Since Next.js supports a range of browsers starting from Chrome 64, Edge 79, Firefox 67, Opera 51, and Safari 12, a polyfill would help ensure compatibility across both browser and server environments. Adding this polyfill can smooth the transition for developers until all supported environments natively supportPromise.withResolvers()
.Proposal
Add the polyfill for
Promise.withResolvers()
in both the Next.js polyfill modules:next-polyfill-module
next-polyfill-nomodule
Beta Was this translation helpful? Give feedback.
All reactions