1

I faced with problem when I try run build app for IE11. When I run serve with --configuration=es5 - it works. But I build with --configuration=es5 - I take not prod version. How I can build prod version for IE11?

My browserlist has "IE 9-11 # For IE 9-11 support, remove 'not'."

My tsconfig.json has "target": "es5".

My tsconfig-es5.app.json

{
  "extends": "./tsconfig.app.json",
  "compilerOptions": {
    "target": "es5"
  }
}

My angular.json

"architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            ...
          },
          "configurations": {
            "es5": {
              "tsConfig": "tsconfig-es5.app.json"
            },
            "production": {
              "fileReplacements": [{
                "replace": "src/environments/environment.ts",
                "with": "src/environments/environment.prod.ts"
              }],
              "optimization": true,
              "outputHashing": "none",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [{
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "charity:build"
          },
          "configurations": {
            "es5": {
              "browserTarget": "charity:build:es5"
            },
            "production": {
              "browserTarget": "charity:build:production"
            }
          }
        },
        ...
    }

I trying add "compilerOptions": { "target": "es5" } for tsconfig.app.json, but I take error message for IE11(Google Chrome works):

ERROR Sys.ParameterCountException: Sys.ParameterCountException: Parameter count mismatch.

Angular 8 build does not work with IE though serve works fine

QuestionMan
  • 205
  • 1
  • 4
  • 15

1 Answers1

1

The issue might due to "build-optimizer" from Angular. I refer to this thread and tried to disable the build optimizer, then it can work well in IE 11 with Angular 8.0.3.

You can run ng build --prod --build-optimizer=false or change the value of buildOptimizer in angular.json to false. Then deploy the production bundles in the dist folder to the web server.

Yu Zhou
  • 11,532
  • 1
  • 8
  • 22