2

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.

3
  • I don't think Chrome 69 have support for features of ES2022 Commented May 31, 2023 at 12:39
  • @Navitas28 Yes, I know. That's why I'm adding a Polyfill to support Chrome 69. But, it's not working. I need help to debug the issue. Commented May 31, 2023 at 13:01
  • I think what Nivatas28 is saying is that the tsconfig.json target is set to ES2022. All modern browsers support es6, per typescript docs: typescriptlang.org/tsconfig#target Chrome 69 was released well after ES6 was. Maybe this is a better target Commented Jun 2, 2023 at 17:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.