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

Next.js not fully functional on Safari for iOS 12 #48627

Open
1 task done
bordeo opened this issue Apr 20, 2023 · 28 comments · Fixed by #49153
Open
1 task done

Next.js not fully functional on Safari for iOS 12 #48627

bordeo opened this issue Apr 20, 2023 · 28 comments · Fixed by #49153
Labels
bug Issue was opened via the bug report template.

Comments

@bordeo
Copy link

bordeo commented Apr 20, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #22 SMP Tue Jan 10 18:39:00 UTC 2023
    Binaries:
      Node: 16.17.0
      npm: 8.15.0
      Yarn: 1.22.19
      pnpm: 7.1.0
    Relevant packages:
      next: 13.3.1-canary.16
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/gracious-zhukovsky-pf41xq

To Reproduce

Access https://nextjs.org/ or https://pf41xq-34085.csb.app/ using Safari on iOS 12 and launch DevTools.

Describe the Bug

@next/react-dev-overlay throw a SyntaxError: Unexpected token '.'

Next.js documentation says it support safari 12+ but it doesn't. https://nextjs.org/docs/basic-features/supported-browsers-features

Screenshot 2023-04-20 at 14 22 18

A possible solution is to change the compilation target of @next/react-dev-overlay here

Expected Behavior

Next.js should work on Safari 12, just like it does on other browsers.

Which browser are you using? (if relevant)

Safari for iOS 12

How are you deploying your application? (if relevant)

No response

@bordeo bordeo added the bug Issue was opened via the bug report template. label Apr 20, 2023
@DB-Alex
Copy link

DB-Alex commented Apr 20, 2023

We are experiencing the same!

@inthisar-hamza
Copy link

same error!

@thomasgauvin
Copy link

I also can't get NextJS working on Safari 12 for iOS. Perhaps the Safari version mentioned in https://nextjs.org/docs/basic-features/supported-browsers-features refers to the desktop version

@shuding
Copy link
Member

shuding commented May 3, 2023

Note that @next/react-dev-overlay is included in dev mode only so this won't affect production.

@bordeo
Copy link
Author

bordeo commented May 4, 2023

Note that @next/react-dev-overlay is included in dev mode only so this won't affect production.

Thanks for the clarification. The same exception can be observed in the production of https://nextjs.org/, indicating that it may not originate from @next/react-dev-overlay.

The exceptions shown in the screenshots are preventing JavaScript from functioning properly, such as preventing the menu from being opened.

Screenshot 2023-05-04 at 08 43 07

@bordeo
Copy link
Author

bordeo commented May 30, 2023

This comment confirms that it's not working.
@shuding, as you said @next/react-dev-overlay may not be the issue.

@BjoernRave
Copy link

did you find any solution for this problem, I am experiencing the same, where I only see a white screen on ios 12

@shuding shuding reopened this Jun 22, 2023
@BjoernRave
Copy link

so next.js 12 works fine for me, but 13 doesnt, I didnt test any minor version in between however, just latest nextjs 13 and latest nextjs 12

@slimshreydy
Copy link

same issue for us too. https://nextjs.org/ seems to fail in an iOS safari 13 browser when tested with browserstack...

(It does work in iOS safari 15 on browserstack, so this is not a browserstack issue)

@inthisar-hamza
Copy link

inthisar-hamza commented Jun 29, 2023 via email

@galaxynova1999
Copy link

galaxynova1999 commented Aug 25, 2023

add next/dist/compiled/@next/react-dev-overlay to transpilePackages will solve this problem

@V-iktor
Copy link

V-iktor commented Aug 28, 2023

add next/dist/compiled/@next/react-dev-overlay to transpilePackages will solve this problem

I doubt react-dev-overlay is running at https://nextjs.org - production builds do not work on iOS 12

Tested on iPad Air 1st gen iOS 12.5.7

@itdat
Copy link

itdat commented Aug 28, 2023

add next/dist/compiled/@next/react-dev-overlay to transpilePackages will solve this problem

This doesn't work for me. Tested on iPhone 6 iOS 12.4.3. Is there another solution, please?

@galaxynova1999
Copy link

add next/dist/compiled/@next/react-dev-overlay to transpilePackages will solve this problem

This doesn't work for me. Tested on iPhone 6 iOS 12.4.3. Is there another solution, please?

I tested on iPhone 6 Plus with iOS 12.5.3 + Next v13.4.16, it works.

did you set browserslist target properly?

"browserslist": [
    "> 0.5%",
    "not dead",
    "ios >= 10",
    "chrome >= 49",
    "not ie <= 11"
  ]
const isDev = process.env.NODE_ENV === 'development';

const getTranspilePackages = () => {
  const sharedPackages = [
    'antd-mobile',
    'ahooks',
    '@react-spring/web',
    'classnames',
    // https://github.com/sindresorhus/filter-obj/issues/31
    'filter-obj',
    'query-string',
  ];
  if (isDev) {
    // https://github.com/vercel/next.js/issues/48627
    return sharedPackages.concat(['next/dist/compiled/@next/react-dev-overlay']);
  }

  return sharedPackages;
};

IMG_0011

@V-iktor
Copy link

V-iktor commented Aug 29, 2023

did you set browserslist target properly?

"browserslist": [
    "> 0.5%",
    "not dead",
    "ios >= 10",
    "chrome >= 49",
    "not ie <= 11"
  ]

That is not the problem, see https://nextjs.org/docs/architecture/supported-browsers#browserslist

Next.js uses the following Browserslist configuration by default:

{
  "browserslist": [
    "chrome 64",
    "edge 79",
    "firefox 67",
    "opera 51",
    "safari 12"
  ]
}

If you do not get the error on iOS 12 in your project like the error on https://nextjs.org it likely means that you are not using the Next code that causes the error.

@V-iktor
Copy link

V-iktor commented Sep 11, 2023

I checked the console on my iPad and it is failing because it does not support resize detection.

Would be nice if it would fail more gracefully.

@DB-Alex
Copy link

DB-Alex commented Sep 12, 2023

Hi @V-iktor can you send a part of the code which is failing?

@V-iktor
Copy link

V-iktor commented Sep 12, 2023

Hi @V-iktor can you send a part of the code which is failing?

Here it is: https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver

@DB-Alex
Copy link

DB-Alex commented Sep 12, 2023

Where is this included in next?

@V-iktor
Copy link

V-iktor commented Sep 13, 2023

Where is this included in next?

It is not. Next should not fail like this when it encounters an error though.

@tgrassl
Copy link

tgrassl commented Nov 12, 2023

This is still an issue with Next 14 in dev and production. You can see it even on the vercel.com website.

@brunorzn
Copy link

I can confirm this is an issue and we have it in production. Any workaround ?

@Jnwy
Copy link

Jnwy commented Jan 9, 2024

I used the workaround transpilePackages: ['next'] in next.config.js to resolve this issue.

@lyyuta
Copy link

lyyuta commented Apr 22, 2024

We are bombarded by SyntaxError: Unexpected token '.' errors on ios 12

image

@tayan-serna
Copy link

In my case, this error was caused by @tanstack/react-query. I hope this comment saves some minutes of anyone's life.

@OscarJVD
Copy link

same error

@brunorzn
Copy link

both Next and Vercel are still down on iPhone 11 for instance.

transpilePackages: ['next'] doesn't solve anything.

Capture d’écran 2024-05-21 à 13 58 11

Any plan to fix this ?!

@meotimdihia
Copy link

I think we should skip iOS 12 because there are not many users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.