Next.js: IE11 polyfills: missing Math.trunc

Created on 7 Apr 2020  路  10Comments  路  Source: vercel/next.js

Bug report

Describe the bug

Math.trunc is not available in IE11. Seeing errors show up in bugsnag for this one.

Expected behavior

Math.trunc should be polyfilled in the IE11 polyfill bundle.

System information

  • OS: all
  • Browser (if applies) IE 11
  • Version of Next.js: latest
bug

All 10 comments

Math polyfills were excluded on purpose as it seemed like something only few applications would use them 馃

More context: we agreed that we could polyfill these Math function(s), but only when used. More than happy to take a PR!

Makes sense not to add APIs which aren't universally applicable to all next users.
We can polyfill on our end.

Happy to submit a PR, but maybe a large question is how do you all think about prioritizing one-off polyfill additions like this?

@Timer Is there any specific help I could give you on this use case? I am more than eager to submit a PR, but currently I don't know, if there is also a way to implement such polyfills, and where to look first for implementing this?

@iDuuck i think that's the place to add the polyfills, just need to import Math polyfills from Corejs
https://github.com/zeit/next.js/blob/canary/packages/next-polyfill-nomodule/src/index.js

After they published then need another PR to upgrade @next/polyfill-nomodule in Next package

I might be wrong.

Thank you, @SarKurd. Next question would be, how they want it to be implemented. At the moment, it would be the easiest, to just set an environment variable and call the import conditionally in the next-polyfill-nomodule package. But as I know the Next.js team, I think, they want something to specify in the next.config.js.

Will have a look at the code.

Sorry i'm not sure. I would just create another file in next-polyfill-nomodule for math polyfills and in Next package would accept another property in next.config.js but it might complicate things and not necessary. might better to wait for their reply

So, I cannot find any reference in the actual Next.js source code to next-polyfill-nomodule. Is it even loaded into the code by default? (Link to search).

I quickly wanted to create a PR, since it's not that much of an issue as I understand. But this confused me.

Never been that confused lately. Thanks for clarification! All clear now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

baldurh picture baldurh  路  74Comments

timneutkens picture timneutkens  路  250Comments

ematipico picture ematipico  路  66Comments

nickredmark picture nickredmark  路  60Comments

tomaswitek picture tomaswitek  路  73Comments