Next.js: Polyfill documentation

Created on 9 Jun 2018  路  8Comments  路  Source: vercel/next.js

Feature request

Is your feature request related to a problem? Please describe.

Currently there is no clear guidelines on implementing polyfils for browsers. There exists examples to polyfill with core-js although there also exists examples to use .babelrc with the env preset to support older browsers.

There is allot of confusion and issues around this topic.

Describe the solution you'd like

A clear section in the documentation that describes using .babelrc and the env preset to polyfill older browsers.

Additional context

We (ethical-jobs) would be happy to write up a PR / example to address this issue if people think its needed.

Most helpful comment

btw. this is false claim this is fixed: https://github.com/zeit/next.js/issues/5783

Polyfills on native objects like [].includes() are not handled by current setup

All 8 comments

So to explain:
Next.js supports ie11 and all modern browsers out of the box without polyfills.

The only time you'd need a polyfill is when you are pulling in an external dependency which is using methods that should be polyfilled in ie11/etc, this is what the with-polyfill example shows. So basically we'd have to document that specific part. I'd be super happy to take in a PR with documentation around this if you're willing to write it up 馃檹

Sure I will try and get one fo the team to do this some time next week.

btw. this is false claim this is fixed: https://github.com/zeit/next.js/issues/5783

Polyfills on native objects like [].includes() are not handled by current setup

I'm not sure what's false here, my comment says exactly what your issue describes.

The only time you'd need a polyfill is when you are pulling in an external dependency which is using methods that should be polyfilled in ie11/etc

Next.js by default with no external dependencies works fine in ie11.

@timneutkens My fault, sorry!

@timneutkens - our app is crashing in IE because of this line in nextjs router: https://github.com/zeit/next.js/commit/b88addfcd5d3d305664ff95a709b4a4df7e0cbcf#diff-49f9285928f23ee1231af5aa2534c70aL66

looks like includes is not polyfilled by default

Was this page helpful?
0 / 5 - 0 ratings

Related issues

knipferrc picture knipferrc  路  3Comments

pie6k picture pie6k  路  3Comments

YarivGilad picture YarivGilad  路  3Comments

sospedra picture sospedra  路  3Comments

rauchg picture rauchg  路  3Comments