How to change target JS version? #69280
Replies: 2 comments
-
I don't think that's true. Check out the list of supported browsers here: https://nextjs.org/docs/architecture/supported-browsers
Right, you would need to use
That doesn't sound right. Which version of Next.js are you using? Have you tried upgrading? |
Beta Was this translation helpful? Give feedback.
-
|
It sounds like your Next.js version is 4 years outdated? I found the PR where we changed the defaults: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
By default Next.js targets an older version of JS in order to support older browsers.
This means that it will transpile JS that uses newer features like the
?.operator, or private class fields.However my website uses newer browser features that can not be transpiled or polyfilled, so this transpilation is of no use to me.
It just makes my build slightly bigger and I suspect browsers might optimize the code better if transpilation was removed.
From what I can see there is no obvious option to change the target JS version in next.config.mjs, not even thought webpack.
And the target field from tsconfig.json is ignored.
Beta Was this translation helpful? Give feedback.
All reactions