Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use IE11 as client code bundle target #1402

Merged
merged 1 commit into from
Mar 1, 2021

Conversation

balazsorban44
Copy link
Member

@balazsorban44 balazsorban44 commented Mar 1, 2021

NOTE: This is WIP. I have to check that some of my statements below are actually correct.

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.

Next.js supports IE11 and all modern browsers (Edge, Firefox, Chrome, Safari, Opera, et al) with no required configuration.
Ref: https://nextjs.org/docs/basic-features/supported-browsers-features

Until now, we used https://github.com/martpie/next-transpile-modules as an alternative, but next-transpile-module explicitly state the following:

What this plugin does not aim to solve:

  • any-package IE11-compatible maker

How:

Leverage @babel/preset-env and overrides 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:

Bundle Before After Change
everything 345.6kB 263.4kB -24%
client 14.8kB 31.5kB +53%
server 330.8kB 232kB -30%

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

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!

@vercel
Copy link

vercel bot commented Mar 1, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nextauthjs/next-auth/35UHaQ9Ay784YnjH8D2CnbVDngJX
✅ Preview: https://next-auth-git-feature-improve-bundling-nextauthjs.vercel.app

@balazsorban44 balazsorban44 changed the base branch from main to next March 1, 2021 20:40
@balazsorban44 balazsorban44 changed the base branch from next to main March 1, 2021 20:41
@balazsorban44 balazsorban44 changed the base branch from main to canary March 1, 2021 20:45
@balazsorban44 balazsorban44 changed the base branch from canary to next March 1, 2021 20:45
@balazsorban44 balazsorban44 changed the title build: use IE11 as client code bundle target feat: use IE11 as client code bundle target Mar 1, 2021
@balazsorban44 balazsorban44 marked this pull request as ready for review March 1, 2021 20:46
@balazsorban44 balazsorban44 merged commit cee0f10 into next Mar 1, 2021
@balazsorban44 balazsorban44 deleted the feature/improve-bundling branch March 1, 2021 20:46
@github-actions
Copy link

github-actions bot commented Mar 1, 2021

🎉 This PR is included in version 4.1.0-next.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant