Skip to content

Optimize Next.js polyfilling behavior (Babel) #8303

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

Closed
Timer opened this issue Aug 9, 2019 · 7 comments
Closed

Optimize Next.js polyfilling behavior (Babel) #8303

Timer opened this issue Aug 9, 2019 · 7 comments

Comments

@Timer
Copy link
Member

Timer commented Aug 9, 2019

Next.js appears to polyfill runtime behavior using transform-runtime rather than preset-env.

This typically creates more bundle code than the useBuiltIns alternative, so we should look at using { helpers: true, useBuiltIns: true } or the most optimized configuration we can find.

It'd also probably be a great time to create a separate polyfills chunk since they seldom change.

@Timer Timer added this to the 9.2.0 milestone Aug 9, 2019
@StarpTech
Copy link
Contributor

Is it also possible to improve the polyfill behaviour for all project dependencies? Gatsby already do this gatsbyjs/gatsby#14111 for production.

@jeroenvisser101
Copy link

Related: #8521

@Timer Timer modified the milestones: 9.2.0, 9.2.x Jan 3, 2020
@timneutkens
Copy link
Member

@StarpTech
Copy link
Contributor

This was solved by nextjs.org/blog/next-9-1-7#new-built-in-polyfills-fetch-url-and-objectassign

@timneutkens not sure if it is really fixed. Your post only refers to specific libs.

More size reduction has been accomplished by providing built-in, small polyfills for often-used packages.

This issue was about polyfill the project based on the environment requirements. Is it done?

@timneutkens
Copy link
Member

This issue was solved over multiple versions. Transform-runtime was replaced with an alternative for useBuiltIns, I did the work for that so I'm sure this issue is fixed 😁

@StarpTech
Copy link
Contributor

Great, thanks!

@Timer Timer removed this from the 10.x.x milestone Nov 16, 2020
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants