feat: use IE11 as client code bundle target #1402
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What:
Explicitly bundle client-side JS code to support IE11.
Why:
IE11 is still a (...painful 😢) browser many companies have to support for legacy reasons. By bundling the client-side code with IE11 as a target, we ensure that
next-auth
is available for a wider range of apps. This is a good choice anyway because as of this writing, Next.js itself supports IE11.Until now, we used https://github.com/martpie/next-transpile-modules as an alternative, but
next-transpile-module
explicitly state the following:How:
Leverage
@babel/preset-env
andoverrides
to set a different target for client code.This PR also sets Node 10 as the minimum target for the rest of the app, which seems to be logical as this is the last maintained Node version. (Going away in April 2021).
This changes the bundle sizes the following way:
Checklist:
There is a discussion around this at #492
There was a comment that people started complaining about the increased client bundle size, which is understandable because it is pretty significant #492 (comment), but I think for the remaining time IE11 is around, we could support it, then drop support the same day it reaches end-of-life. If Next.js itself does that, it is logical that we do the same.
This PR is open for discussion, please tell me what you think!