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

fix: support vite client in safari 13 #9315

Merged
merged 1 commit into from
Jul 23, 2022
Merged

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Jul 23, 2022

Description

Fix #9190 (comment)

Our baseline supports Safari 13, which doesn't support optional chaining. Since vite/client is served unbundled, we should also support Safari 13. Changing the typescript compile target to es2019 from es2020 (declared in tsconfig.base.json), transpile the optional chaining usage.

cc @Amareis

Additional context

Diff of new vs old client.mjs:

bjorn@Bjorns-MacBook-Pro vite % diff client.mjs client2.mjs
122d121
<         var _a;
135c134
<         const [file] = (((_a = err.loc) === null || _a === void 0 ? void 0 : _a.file) || err.id || 'unknown file').split(`?`);
---
>         const [file] = (err.loc?.file || err.id || 'unknown file').split(`?`);
179,180c178
<         var _a;
<         (_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this);
---
>         this.parentNode?.removeChild(this);

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bluwy bluwy added the p3-minor-bug An edge case that only affects very specific usage (priority) label Jul 23, 2022
@Amareis
Copy link

Amareis commented Jul 23, 2022

Yep, that's really needed for testing on old iPhones!

(But i still think that support for safari 12 will be much better, since it has no real differences with 13, but still have some users)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants