0

Getting syntax error in vendor.js file while running angular 9 application in IE 11. I've enabled all the polyfills and changed the target to "es5" in tsconfig.json as well.

any help will be appreciated!

package.json

    "@angular/core": "~9.0.5",
    "@angular/platform-browser": "~9.0.5",
    "@ng-idle/core": "^10.0.0-beta.1",
    "@ng-idle/keepalive": "^10.0.0-beta.1",
    "classlist.js": "1.1.20150312",
    "core-js": "^3.8.2",    
    "zone.js": "^0.10.3"
    "typescript": "~3.7.5"

tsconfig.json

{
    "compileOnSave": false,
    "compilerOptions": {
        "baseUrl": "./",
        "outDir": "./dist/out-tsc",
        "sourceMap": true,
        "declaration": false,
        "module": "es2015",
        "moduleResolution": "node",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "target": "es5",
        "typeRoots": ["node_modules/@types"],
        "lib": ["es2015", "es5", "es6", "dom"]
    }
}

2 Answers2

0

Did you change the parameters for lib in tsconfig.json file? I try to create an Angular 9 application on my side and I found that lib contains the below parameters.

"lib": [
      "es2018",
      "dom"
    ]

If you have done some modifications then I suggest you revert those changes to their original values.

To run the newly created Angular 9 application in the IE 11 browser, you just need to set "target": "es5" in tsconfig.json. Other than that no changes required.

Further, you can add polyfills if your project requires them.

If you have added some code or functionality in the application and after that, you are not able to run the application in IE 11 then kindly provide information about it. It can help us understand the issue in a better way.

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19
  • I did try with lib: ["es2018", "dom"] but sill getting the same issue. The issue is due to the ng-idle package. When I am uninstalling the package the application works fine in IE11. – Shlok Patel Jan 15 '21 at 20:03
  • Do you mean if you just add the `ng-idle` package then the project starts giving an error? or if there is any code that can help to produce the issue then please try to share it with us. – Deepak-MSFT Jan 19 '21 at 09:45
0

I was getting exact same issue and tried multiple alternatives and options with tsconfig.json, polyfills.ts, package.json, but nothing worked for me.

Finally one solution which made my application to work in IE browser was using one lower version of these dependencies -
"@ng-idle/core": "^9.0.0-beta.1", "@ng-idle/keepalive": "^9.0.0-beta.1"