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

Astro fails to hydrate svelte component in Safari 13. #11082

Open
1 task
Darshan-H-E opened this issue May 17, 2024 · 2 comments
Open
1 task

Astro fails to hydrate svelte component in Safari 13. #11082

Darshan-H-E opened this issue May 17, 2024 · 2 comments
Labels
needs response Issue needs response from OP needs triage Issue needs to be triaged

Comments

@Darshan-H-E
Copy link

Astro Info

Astro                    v4.6.0
Node                     v20.12.2
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/svelte

If this issue only occurs in one browser, which browser is a problem?

Safari 13

Describe the Bug

The "Example" svelte component is hydrated successfully for safari 14 and above but fails to hydrate for safari 13. It throws the following error in console.

• SyntaxError: Unexpected token '.'
• SyntaxError: Unexpected token ';'. Expected an opening '(' before a method's parameter list.
• [astro-island] Error hydrating /src/components/Example.svelte -
SyntaxError: Unexpected token ';'. Expected an opening '(' before a method's parameter list. - client:959

What's the expected result?

The "Example" svelte component should be hydrated successfully for safari 13.

Link to Minimal Reproducible Example

https://github.com/Darshan-H-E/astro-safari-13-bug

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label May 17, 2024
@bluwy
Copy link
Member

bluwy commented May 17, 2024

Is this in dev? In dev you should be using the latest browser possible as the code isn't transpiled to lower browser targets for performance (by Vite). The error is likely due to Safari not recognizing ?.. If you want to test lower browser versions, you should build your project first, and make sure you have the proper browser targets set, e.g. vite.build.target (only covers syntax support, not polyfills).

@bluwy bluwy added the needs response Issue needs response from OP label May 17, 2024
@Darshan-H-E
Copy link
Author

The bug is observed in both production build and dev. I'm trying to use astro for a website that I'm working on which is displayed in WKWebview of an iOS project. The minimum support version of this iOS project is iOS 13 which uses Safari 13.

Regarding polyfills, could you redirect me to relevant documentation which would help me achieve polyfill in this case so that I can support Safari 13 as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs response Issue needs response from OP needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants