2023-06-06

Angular Polyfill for Angular 14 app giving an error

I recently upgraded my angular app from v14 to v15. Due to a business need, we need to support Chrome 69 for the app. So, I added the following lines of code in my polyfills.ts file:

import '@angular/localize/init';
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import 'zone.js/dist/zone';

The compilerOptions in my tsconfig.json are as follows:

"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"module": "es2020",
"moduleResolution": "node",
"importHelpers": true,
"target": "ES2022",
"typeRoots": [
  "node_modules/@types"
],
"lib": [
  "es2020",
  "dom"
],
"useDefineForClassFields": false

}

Now, my code works in the latest chrome browser. But, it doesn't load in Chrome 69. I see the below error lines in the dev console of Chrome 69.

Uncaught SyntaxError: Unexpected token .     /polyfills.js:1
Uncaught SyntaxError: Unexpected token .     /main.js:1

Any help in resolving this issue would be greatly appreciated. Thanks in Advance.



No comments:

Post a Comment