Angular apps not working in Safari v15 due to `ReferenceError`
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
Don’t known / other
Is this a regression?
No
Description
When we open angular.io website in safari browser in mac then it giving blank page and if we do refresh that page than also it’s giving blank page and when we open inspect element from developer open in safari browser and do refresh that page then it open perfectly so it’s an issue I have provided screenshot.
-
This when I open angular.io link in Safari browser in Mac.
-
This when I open inspect element of safari browser and still website is not working.
-
And at last this after opening Inspect element I refresh the page then website is working properly.
Please provide a link to a minimal reproduction of the bug
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version
)
No response
Anything else?
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
fix(@angular-devkit/build-angular): downlevel class properties ...
Successfully merging this pull request may close these issues. Angular apps not working in Safari v15 due to ReferenceError. 3 ...
Read more >Angular app not working on Firefox and Safari - Stack Overflow
My Angular app is not working in Firefox and Safari after build, But it is fine with Chrome. I tried by loading web...
Read more >Tweets with replies by Emma Twersky (@twerske) / Twitter
Angular apps not working in Safari v15 due to `ReferenceError` · Issue #24355 · angular/angular-cli. Which @angular/* package(s) are the source of the...
Read more >Browser support - Angular
Angular is built on the latest standards of the web platform. Targeting such a wide range of browsers is challenging because they do...
Read more >How to debug Angular App in Chrome | BrowserStack
If you're having trouble debugging your Angular app in Chrome, this guide will show you how to do it so you can get...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi all, I’ve tracked down the root cause. It’s a very subtle bug that got fixed in Safari v16. And yes, the bug doesn’t reproduce when the devtools are opened. Here is how I tracked it down:
$o
. Safari stack trace was incorrect.optimization: false
. Fortunately the issue was reproducable even with unoptimized build (making debugging easier):notification_component_c0
.static #_ = this.ecmp = X
static {}
blocks.static {}
blocks- but static fields.useDefineForClassFields = false
(which is the case in Angular v15 w/ target: 2022)(0, x).method()
in the static field initializer. In other scenarios, the error quickly was gone- almost seeming like it’s non-deterministic.this
context when it invokes methods. e.g. for animationsTL;DR: Angular emits valid JavaScript that is subject to a bug in Safari that got fixed in Safari v16. The issue does not reproduce when devtools are opened- and the Safari bug is related to scope tracking in the WebKit JS parsing. https://github.com/WebKit/WebKit/commit/e8788a34b3d5f5b4edd7ff6450b80936bff396f2. All Angular applications could be affected, but hard to notice/narrow down
We will look into downleveling static fields for Safari <16 so that Angular apps remain compatible with that browser, if selected via browserslist (or the default one).
Same hapenning on iOS 15.4. Don’t know about devtools though. But we had similar issue and It was connected to app being PWA - the issue that it did work when dev tools were open.