Skip to content

Angular 8 error on Safari 10 Mobile (iOS 10.3.3 iPad): "Zone.js has detected that ZoneAwarePromise (window|global).Promise has been overwritten" #15152

@Ks89

Description

@Ks89

🐞 Bug report

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 7.x.x

Description

If you create an empty app with ng new, you cannot run it on Safari 10 Mobile (iOS 10.3.3), because it throws this error on console:

[Error] Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)
	assertZonePatched (polyfills-es5.2219c87348e60efc0076.js:1:3142)
	t (main-es5.d1c9edb576425b4c6fb4.js:1:78504)
	bootstrapModuleFactory (main-es5.d1c9edb576425b4c6fb4.js:1:85139)
	zUnb (main-es5.d1c9edb576425b4c6fb4.js:1:248620)
	f (runtime-es2015.703a23e48ad83c851e49.js:1:512)
	(anonymous function) (main-es5.d1c9edb576425b4c6fb4.js:1:88)
	f (runtime-es2015.703a23e48ad83c851e49.js:1:512)
	t (runtime-es2015.703a23e48ad83c851e49.js:1:378)
	(anonymous function) (runtime-es2015.703a23e48ad83c851e49.js:1:1418)
	Module Code (runtime-es2015.703a23e48ad83c851e49.js:1:1437)
	evaluate
	moduleEvaluation

I already talked about this issue HERE, but the discussion is dead, so I decided to create a new dedicated issue
In issue #30928 the problems seems fixed, but it's not true, because it happens also with a basic app created by ng new.

🔬 Minimal Reproduction

  1. create a new project with ng new ng-safari10 with routing and SCSS (probably they aren't mandatory to reproduce this issue)
  2. use this browserslist file content
> 0.5%
last 2 versions
Firefox ESR
not dead
IE 11
Firefox 67
Safari 10
ios_saf 10
  1. Check the output of npm browserslist to see if there is 'ios_saf 10.0-10.2':
and_chr 75
and_ff 67
and_qq 1.2
and_uc 11.8
android 67
baidu 7.12
chrome 75
chrome 74
chrome 73
chrome 72
edge 18
edge 17
firefox 67
firefox 66
firefox 60
ie 11
ie_mob 11
ios_saf 12.2
ios_saf 12.0-12.1
ios_saf 11.3-11.4
ios_saf 10.0-10.2
kaios 2.5
op_mini all
op_mob 46
opera 58
opera 57
safari 12.1
safari 12
safari 10
safari 5.1
samsung 9.2
samsung 8.2
samsung 4
  1. build with ng build --prod --aot or ng build
  2. cd dist/ng-safari10 && lite-server

This is the package.json created automatically by ng new:

"dependencies": {
    "@angular/animations": "~8.1.2",
    "@angular/common": "~8.1.2",
    "@angular/compiler": "~8.1.2",
    "@angular/core": "~8.1.2",
    "@angular/forms": "~8.1.2",
    "@angular/platform-browser": "~8.1.2",
    "@angular/platform-browser-dynamic": "~8.1.2",
    "@angular/router": "~8.1.2",
    "rxjs": "~6.4.0",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.801.2",
    "@angular/cli": "~8.1.2",
    "@angular/compiler-cli": "~8.1.2",
    "@angular/language-service": "~8.1.2",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  }

If you need more info, feel free to ask.

🔥 Exception or Error


[Error] Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)
	assertZonePatched (polyfills-es5.2219c87348e60efc0076.js:1:3142)
	t (main-es5.d1c9edb576425b4c6fb4.js:1:78504)
	bootstrapModuleFactory (main-es5.d1c9edb576425b4c6fb4.js:1:85139)
	zUnb (main-es5.d1c9edb576425b4c6fb4.js:1:248620)
	f (runtime-es2015.703a23e48ad83c851e49.js:1:512)
	(anonymous function) (main-es5.d1c9edb576425b4c6fb4.js:1:88)
	f (runtime-es2015.703a23e48ad83c851e49.js:1:512)
	t (runtime-es2015.703a23e48ad83c851e49.js:1:378)
	(anonymous function) (runtime-es2015.703a23e48ad83c851e49.js:1:1418)
	Module Code (runtime-es2015.703a23e48ad83c851e49.js:1:1437)
	evaluate
	moduleEvaluation

🌍 Your Environment


Angular CLI: 8.1.2
Node: 10.16.0
OS: darwin x64
Angular: 8.1.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.2
@angular-devkit/build-angular     0.801.2
@angular-devkit/build-optimizer   0.801.2
@angular-devkit/build-webpack     0.801.2
@angular-devkit/core              8.1.2
@angular-devkit/schematics        8.1.2
@ngtools/webpack                  8.1.2
@schematics/angular               8.1.2
@schematics/update                0.801.2
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.35.2

Anything else relevant?
Safari 10 for iPad with iOS 10.3.3, if you need mode info about iPad model feel free to ask.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions