Clarify recommended ESxxxx version #15873
Replies: 1 comment
-
I've been trying to determine what things are polyfilled by Next.js, and it's not at all obvious. As best I can tell, this file includes all the polyfills that are provided on the condition that the browser returns true for the So, the difficulty here is that the polyfills don't neatly fit into one of the library groups (ES2018 etc) that "lib": [
"dom",
"dom.iterable",
"ES2018",
"ES2019.Array"
], Additionally, this also assumes that Next.js even knows what browsers we're targeting. Even if Next.js could specify exactly what polyfills it will provide to those This is all to say (from my cobbled together understanding) this is probably not a problem with a clear solution. What could help matters is to have some clearer documentation about how this works, and the reasoning behind it. Perhaps even just a link from the docs to the list of polyfills we get from next.js |
Beta Was this translation helpful? Give feedback.
-
I noticed in #15772 that the title suggests ES2019 features will be polyfilled, but the description suggests ES2018.
The default for
lib
in writeConfigurationDefaults.ts seems to be ESNext if not already configured.Looking through the
tsconfig.json
of the various with-x-typescript examples shows a mix in thelib
setting, for example:with-typescript: ES2017
with-stripe-typescript: ESNext
Is there a definitive ES version that the Next.js team are targeting or can at least recommend? I appreciate that individual projects can choose to add extra polyfills as needed, but I think it would help to be consistent and possibly document what the framework is targeting.
Beta Was this translation helpful? Give feedback.
All reactions