1

I upgraded to Angular 16, i have upgraded packages and I get the following error in Safari: SyntaxError: Invalid character: '#' My safari version is 14. In Chrome I do not get this error and the application opens.

See the package.json

{
  "name": "carpathia",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~16.0.4",
    "@angular/cdk": "~16.0.3",
    "@angular/common": "~16.0.4",
    "@angular/compiler": "~16.0.4",
    "@angular/core": "~16.0.4",
    "@angular/forms": "~16.0.4",
    "@angular/localize": "^16.0.4",
    "@angular/material": "^16.0.3",
    "@angular/platform-browser": "~16.0.4",
    "@angular/platform-browser-dynamic": "~16.0.4",
    "@angular/router": "~16.0.4",
    "rxjs": "~7.8.1",
    "stable": "^0.1.8",
    "tslib": "^2.5.3",
    "webpack": "^5.85.0",
    "yarn": "^1.22.19",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.0.4",
    "@angular/cli": "~16.0.4",
    "@angular/compiler-cli": "~16.0.4",
    "@angular/language-service": "~16.0.4",
    "@types/jasmine": "~4.3.2",
    "@types/jasminewd2": "~2.0.10",
    "@types/node": "^20.2.5",
    "codelyzer": "^6.0.2",
    "jasmine-core": "^4.0.0",
    "jasmine-spec-reporter": "~7.0.0",
    "karma": "~6.4.2",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "^2.0.0",
    "protractor": "^7.0.0",
    "terser-webpack-plugin": "^5.3.9",
    "ts-node": "~10.9.1",
    "tslint": "^6.1.3",
    "typescript": ">=4.9.3 and <5.1.0",
    "webpack-cli": "^5.1.2"
  }
}

I tried to downgrade packages, changes different versions of Webpack, downgraded and upgraded Node and removed the custom styles but nothing worked. When I run npx browserslist I see that Safari 14 is not on the list and nothing worked to get it on the list.

Alin Lazar
  • 11
  • 2
  • I would encourage you to go through and check if the version numbers are compatible with Angular 9 – dtthom09 Jun 04 '23 at 19:58
  • Where does it say that error is coming from? It's hard to take a guess at what would cause this without that information. Your package file doesn't really give a lot of information about a runtime error in Safari. – Chris Barr Jun 04 '23 at 23:49

1 Answers1

0

Safari 14 doesn't support private methods https://caniuse.com/mdn-javascript_classes_private_class_methods

So you need to polyfill with babel or downgrade back

Anton
  • 1