Vendor.js throwing syntax error for ng-idle library for IE 11

781 views Asked by At

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

There are 2 answers

0
Pooja Udani On BEST ANSWER

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"

2
Deepak-MSFT On

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.