0

Recently we have upgraded our application from Angular 5 to 8. It is working fine in Chrome and Microsoft Edge but not in IE 11. I am not using Angular CLI so please do not post CLI based solutions.

I added core-js and core-js-bundle as a polyfill to make it work with IE 11 but no success till now.

Here is my package.json

"dependencies": {
    "@angular/animations": "~8.2.0",
    "@angular/common": "~8.2.0",
    "@angular/compiler": "~8.2.0",
    "@angular/core": "~8.2.0",
    "@angular/forms": "~8.2.0",
    "@angular/platform-browser": "~8.2.0",
    "@angular/platform-browser-dynamic": "~8.2.0",
    "@angular/router": "~8.2.0",
    "brace": "^0.11.1",
    "core-js": "^3.6.5",
    "core-js-bundle": "^3.6.5",
    "moment": "2.18.1",
    "ng2-ace-editor": "^0.3.9",
    "ng2-dragula": "1.5.0",
    "primeicons": "^2.0.0",
    "primeng": "6.1.7",
    "reflect-metadata": "^0.1.3",
    "rxjs": "~6.4.0",
    "systemjs": "^0.19.27",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  }

This is my index.html

<script src="~/App/Shared/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/App/node_modules/core-js-bundle/index.js"></script>
<script src="~/App/node_modules/zone.js/dist/zone.js"></script> 
<script src="~/App/node_modules/reflect-metadata/Reflect.js"></script> 
<script src="~/App/node_modules/systemjs/dist/system.src.js"></script>
<script src="~/App/Shared/Scripts/systemjs.config.js"></script>
 
<script>

    // bootstrap the application
    System.import('myApp').then(function (m) {
        m.bootstrap();
    })
</script>

<my-app>
    <div style="padding-top:20px;">Loading...</div>
</my-app>

Here is the tsconfig.json ( I have tried using lib : es2018 as well )

{
  "compileOnSave": true,
  "compilerOptions": {
    "lib": [ "es2017", "dom" ],
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true
  },
  "exclude": [
    "node_modules"
  ]
}

If I don't include core-js-bundle.js file in the html, I get these errors:

SCRIPT5009: 'Symbol' is undefined

Potentially unhandled rejection [2] TypeError: Object doesn't support property or method 'fill'
       at ReflectionCapabilities.prototype._ownParameters (eval code:10977:13)
       at ReflectionCapabilities.prototype.parameters (eval code:10986:13)
       at convertInjectableProviderToFactory (eval code:11318:17)
       at preR3NgModuleCompile (eval code:25627:9)
       at ɵ1$5 (eval code:25616:29)
       at TypeDecorator (eval code:228:21)
       at DecorateConstructor (http://localhost/UI/App/node_modules/reflect-metadata/Reflect.js:541:17)
       at decorate (http://localhost/UI/App/node_modules/reflect-metadata/Reflect.js:130:17)
       at __decorate (eval code:161:84)
       at Anonymous function (eval code:6477:9)

If I include core-js-bundle.js file in the html, I get this errors:

HTML1300: Navigation occurred.
File: reports
Unhandled Promise rejection: Multiple definitions of a property not allowed in strict mode ; Zone: <root> ; Task: Promise.then ; Value: SyntaxError: Multiple definitions of a property not allowed in strict mode SyntaxError: Multiple definitions of a property not allowed in strict mode
   at JitEvaluator.prototype.evaluateCode (eval code:6789:13)
   at JitEvaluator.prototype.evaluateStatements (eval code:6759:13)
   at JitCompiler.prototype._interpretOrJit (eval code:27708:17)
   at JitCompiler.prototype._compileTemplate (eval code:27678:13)
   at Anonymous function (eval code:27619:53)
   at forEach (http://localhost/UI/App/node_modules/core-js-bundle/index.js:5237:11)
   at JitCompiler.prototype._compileComponents (eval code:27619:13)
   at Anonymous function (eval code:27529:17)
   at ZoneDelegate.prototype.invoke (http://localhost/UI/App/node_modules/zone.js/dist/zone.js:390:13)
   at Zone.prototype.run (http://localhost/UI/App/node_modules/zone.js/dist/zone.js:150:17)
   "Unhandled Promise rejection:"
   "Multiple definitions of a property not allowed in strict mode"

Adding more details about how this application was built without CLI

We started building this web application when Angular 1.5 was released. Initially our application was consist of ASP.net + Angular 1 modules. Then angular 2 came with totally different framework. So instead of converting existing modules ( As that will be lot of work). We decided to develop new modules in Angular 2 and gradually upgrade the angular 1 modules. We followed the pattern of mini-SPAs, where angular 1 modules are in one SPA and angular 2 modules are in other SPA. I don't think so CLI was a thing back then ( when we started developing angular 2 modules ). To load the modules, we use SystemJS. As it is shown from the HTML I posted.

Imran Khan
  • 117
  • 2
  • 11
  • Have you try to do this -> https://stackoverflow.com/questions/56379067/how-do-i-support-internet-explorer-in-an-angular-8-application – Carlos1232 Jun 26 '20 at 21:10
  • @Carlos1232 Accepted answer and many other solutions in that thread are for angular CLI. Like I mentioned I am not using CLI. Most of the other responses are talking about using {"target" : es5} instead of es2015. Which I am already using. Is there any specific response you're talking about ? – Imran Khan Jun 27 '20 at 05:00
  • Yes there's an answer from Deva where She/He adds polyfills, also, I can see that when you dont add core-js-bundle.js it is telling you an error about Array.prototype.fill wich is not supported, here's a link for .fill -> https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Array/fill – Carlos1232 Jun 27 '20 at 06:05
  • yeah I tried that. Adding just a fill method. It fixed that problem then it started to complaint about 'Symbol'. I have searched a lot but couldn't find any polyfill for that. – Imran Khan Jun 27 '20 at 14:05
  • Also How to add these polyfills -> import 'core-js/es6/symbol'; If I reference this in my html file like It throws an error that 'require' is undefined. – Imran Khan Jun 27 '20 at 14:10
  • The problem there is that you don't have to add the es6 read in the comments of that answer how to import correctly for i.e 11 and also remember that angular 10 is no longer compatible with I.E – Carlos1232 Jun 28 '20 at 15:05
  • Please try to provide detailed information about how you have created an Angular 8 app without using the CLI. It can help us to know your approach and we can try to create an app in that way and try to test it with the IE 11 browser. It may help to narrow down this issue. Thanks for your understanding. – Deepak-MSFT Jun 29 '20 at 02:11
  • @Deepak-MSFT... Added more details. – Imran Khan Jun 29 '20 at 13:12
  • @Carlos1232... Tried what was suggested in that thread... didn't work. Throwing same error : SCRIPT5009: 'Symbol' is undefined unhandled rejection [2] TypeError: Object doesn't support property or method 'fill' – Imran Khan Jun 29 '20 at 14:03
  • Can you try to provide a sample app that can generate the issue with the IE 11 browser? It can be really helpful to understand the issue in a better way. Thanks for your understanding. – Deepak-MSFT Jun 30 '20 at 02:08
  • **I have resolved the issue.** This is what I did.. First I removed all the Angular 8 modules and load a simple "Hello World" module to check whether the problem is in my code or not? It loaded that module successfully. That indicated that the issue was in one of my module . I started to load one module at a time and it turned out that one of the module that is using PrimeNG tree table was causing the issue. I made changes to the tree table to make it work with newer version of PrimeNG and application started to work ! – Imran Khan Jul 07 '20 at 13:10

0 Answers0