next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Polyfills for findLast and findLastIndex are missing

Open mzronek opened this issue 1 year ago • 1 comments

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/optimistic-brook-jhgh2h

To Reproduce

  1. Use findLast and findLastIndex in a client component
  2. Adapt browserslist to: "browserslist": ["defaults", "iOS >= 15"]
  3. Build app
  4. findLast and findLastIndex were not polyfilled

Current vs. Expected behavior

I expected findLast and findLastIndex to be polyfilled due to "iOS > 15" in the browerslist. It is not supported by Safaria on iOS < 15.4.

Provide environment information

Operating System:
  Platform: linux
  Arch: arm64
  Version: #1 SMP PREEMPT_DYNAMIC Sat Apr 27 18:11:03 UTC 2024
  Available memory (MB): 21377
  Available CPU cores: 16
Binaries:
  Node: 20.14.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: 9.1.4
Relevant Packages:
  next: 14.2.3 // Latest available version is detected (14.2.3).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.4.5
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Runtime, SWC

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local)

Additional context

I checked next-polyfill and it already includes a good number of polyfills from core-js. core-js already has polyfills for findLast and findLastIndex, so this might be two lines of code.

https://github.com/zloirock/core-js/tree/master/packages/core-js/stable/array

There was also a discussion about this here: https://github.com/vercel/next.js/discussions/46724

Reproduction image on latest Chrome and iOS 15.2 Simulator:

image

mzronek avatar Jun 05 '24 10:06 mzronek

This issue has been automatically marked as stale due to inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.

nextjs-bot avatar Dec 02 '25 23:12 nextjs-bot

This issue has been automatically closed due to inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding!

nextjs-bot avatar Dec 10 '25 23:12 nextjs-bot