title: main.js:1 Uncaught TypeError:Cannot read property 'prototype' of undefined
body: <p>I have upgraded my project from Angular 8 to Angular 11. it runs fine in DEV mode, but if I run it in Prod mode or build it and deploy it to web server. I am getting below error when launching the website in browser:</p>
  <pre><code>main.js:1 Uncaught TypeError: Cannot read property 'prototype' of undefined
      at main.js:1
      at main.js:1
      at Module.zUnb (main.js:1)
      at l (runtime.js:1)
      at Object.0 (main.js:1)
      at l (runtime.js:1)
      at t (runtime.js:1)
      at Array.r [as push] (runtime.js:1)
      at main.js:1
  </code></pre>
  <p>Something wrong when it compiles the code to bundles using webpack, I guess.
  package.json before upgrade:</p>
  <pre><code>{
    &quot;name&quot;: &quot;xxxxxx&quot;,
    &quot;version&quot;: &quot;1.1.1&quot;,
    &quot;license&quot;: &quot;UNLICENSED&quot;,
    &quot;scripts&quot;: {
      &quot;ng&quot;: &quot;ng&quot;,
      &quot;start&quot;: &quot;ng serve&quot;,
      &quot;start-ssl&quot;: &quot;ng serve --proxy-config proxy.conf.json --ssl true&quot;,
      &quot;start-nossl&quot;: &quot;ng serve --proxy-config proxy.conf.json&quot;,
      &quot;build&quot;: &quot;ng build&quot;,
      &quot;build-prod&quot;: &quot;node --max_old_space_size=2000000 ./node_modules/@angular/cli/bin/ng build --prod --base-href /caui/&quot;,
      &quot;build-prod19&quot;: &quot;node --max_old_space_size=2000000 ./node_modules/@angular/cli/bin/ng build --prod --base-href /caui19/&quot;,
      &quot;build-test&quot;: &quot;node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng test --watch=false -cc&quot;,
      &quot;test&quot;: &quot;ng test&quot;,
      &quot;lint&quot;: &quot;ng lint&quot;,
      &quot;e2e&quot;: &quot;ng e2e&quot;
    },
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
      &quot;@angular/animations&quot;: &quot;8.2.0&quot;,
      &quot;@angular/common&quot;: &quot;8.2.0&quot;,
      &quot;@angular/compiler&quot;: &quot;8.2.0&quot;,
      &quot;@angular/compiler-cli&quot;: &quot;8.2.0&quot;,
      &quot;@angular/core&quot;: &quot;8.2.0&quot;,
      &quot;@angular/forms&quot;: &quot;8.2.0&quot;,
      &quot;@angular/platform-browser&quot;: &quot;8.2.0&quot;,
      &quot;@angular/platform-browser-dynamic&quot;: &quot;8.2.0&quot;,
      &quot;@angular/platform-server&quot;: &quot;8.2.0&quot;,
      &quot;@angular/router&quot;: &quot;8.2.0&quot;,
      &quot;@angular/cdk&quot;: &quot;8.1.2&quot;,
      &quot;@ng-bootstrap/ng-bootstrap&quot;: &quot;5.1.1&quot;,
      &quot;@ngrx/core&quot;: &quot;^1.2.0&quot;,
      &quot;@ngrx/effects&quot;: &quot;^8.2.0&quot;,
      &quot;@ngrx/router-store&quot;: &quot;^8.2.0&quot;,
      &quot;@ngrx/store&quot;: &quot;^8.2.0&quot;,
      &quot;@swimlane/ngx-datatable&quot;: &quot;15.0.2&quot;,
      &quot;@types/lodash&quot;: &quot;^4.14.136&quot;,
      &quot;ag-grid-angular&quot;: &quot;^20.2.0&quot;,
      &quot;ag-grid-community&quot;: &quot;^20.2.0&quot;,
      &quot;angular-tree-component&quot;: &quot;^8.4.0&quot;,
      &quot;angular2-csv&quot;: &quot;^0.2.9&quot;,
      &quot;angular2-hotkeys&quot;: &quot;^2.1.5&quot;,
      &quot;core-js&quot;: &quot;^3.1.4&quot;,
      &quot;font-awesome&quot;: &quot;^4.7.0&quot;,
      &quot;lodash&quot;: &quot;^4.17.15&quot;,
      &quot;ng-http-loader&quot;: &quot;^6.0.1&quot;,
      &quot;ngrx-store-localstorage&quot;: &quot;^8.0.0&quot;,
      &quot;ngx-clipboard&quot;: &quot;^12.2.0&quot;,
      &quot;primeicons&quot;: &quot;^2.0.0&quot;,
      &quot;primeng&quot;: &quot;^8.0.2&quot;,
      &quot;reselect&quot;: &quot;^4.0.0&quot;,
      &quot;rxjs&quot;: &quot;^6.5.2&quot;,
      &quot;rxjs-compat&quot;: &quot;6.5.2&quot;,
      &quot;zone.js&quot;: &quot;^0.10.0&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@angular-devkit/build-angular&quot;: &quot;~0.802.0&quot;,
      &quot;@angular/cli&quot;: &quot;8.2.0&quot;,
      &quot;@angular/language-service&quot;: &quot;8.2.0&quot;,
      &quot;@types/jasmine&quot;: &quot;^3.3.16&quot;,
      &quot;@types/jasminewd2&quot;: &quot;^2.0.6&quot;,
      &quot;@types/node&quot;: &quot;~8.9.4&quot;,
      &quot;codelyzer&quot;: &quot;^5.1.0&quot;,
      &quot;jasmine-core&quot;: &quot;^3.4.0&quot;,
      &quot;jasmine-spec-reporter&quot;: &quot;^4.2.1&quot;,
      &quot;karma&quot;: &quot;^4.2.0&quot;,
      &quot;karma-chrome-launcher&quot;: &quot;^2.2.0&quot;,
      &quot;karma-cli&quot;: &quot;^2.0.0&quot;,
      &quot;karma-coverage-istanbul-reporter&quot;: &quot;^2.1.0&quot;,
      &quot;karma-jasmine&quot;: &quot;^2.0.1&quot;,
      &quot;karma-jasmine-html-reporter&quot;: &quot;^1.4.2&quot;,
      &quot;ngrx-store-logger&quot;: &quot;^0.2.4&quot;,
      &quot;protractor&quot;: &quot;~5.1.2&quot;,
      &quot;ts-node&quot;: &quot;~8.3.0&quot;,
      &quot;tslint&quot;: &quot;^5.18.0&quot;,
      &quot;typescript&quot;: &quot;^3.5.3&quot;,
      &quot;webpack&quot;: &quot;^4.39.1&quot;
    }
  </code></pre>
  <p>package.json after upgrade:</p>
  <pre><code>{
    &quot;name&quot;: &quot;xxxxxx&quot;,
    &quot;version&quot;: &quot;18.5.0&quot;,
    &quot;license&quot;: &quot;UNLICENSED&quot;,
    &quot;scripts&quot;: {
      &quot;ng&quot;: &quot;ng&quot;,
      &quot;start&quot;: &quot;ng serve&quot;,
      &quot;start-ssl&quot;: &quot;node --max_old_space_size=2000000 ./node_modules/@angular/cli/bin/ng serve --proxy-config proxy.conf.json --ssl true --prod&quot;,
      &quot;start-nossl&quot;: &quot;node --max_old_space_size=2000000 ./node_modules/@angular/cli/bin/ng serve --proxy-config proxy.conf.json --prod&quot;,
      &quot;build&quot;: &quot;ng build&quot;,
      &quot;build-prod&quot;: &quot;node --max_old_space_size=2000000 ./node_modules/@angular/cli/bin/ng build --prod --base-href /caui/&quot;,
      &quot;build-prod19&quot;: &quot;node --max_old_space_size=2000000 ./node_modules/@angular/cli/bin/ng build --prod --base-href /caui19/&quot;,
      &quot;build-test&quot;: &quot;node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng test --watch=false -cc&quot;,
      &quot;test&quot;: &quot;ng test&quot;,
      &quot;lint&quot;: &quot;ng lint&quot;,
      &quot;e2e&quot;: &quot;ng e2e&quot;
    },
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
      &quot;@angular/animations&quot;: &quot;~11.2.1&quot;,
      &quot;@angular/common&quot;: &quot;~11.2.1&quot;,
      &quot;@angular/compiler&quot;: &quot;~11.2.1&quot;,
      &quot;@angular/core&quot;: &quot;~11.2.1&quot;,
      &quot;@angular/forms&quot;: &quot;~11.2.1&quot;,
      &quot;@angular/platform-browser&quot;: &quot;~11.2.1&quot;,
      &quot;@angular/platform-browser-dynamic&quot;: &quot;~11.2.1&quot;,
      &quot;@angular/router&quot;: &quot;~11.2.1&quot;,
      &quot;@angular/cdk&quot;: &quot;11.1.1&quot;,
      &quot;@ng-bootstrap/ng-bootstrap&quot;: &quot;5.1.1&quot;,
      &quot;@ngrx/core&quot;: &quot;^1.2.0&quot;,
      &quot;@ngrx/effects&quot;: &quot;^11.0.1&quot;,
      &quot;@ngrx/router-store&quot;: &quot;^11.0.1&quot;,
      &quot;@ngrx/store&quot;: &quot;^11.0.1&quot;,
      &quot;@swimlane/ngx-datatable&quot;: &quot;19.0.0&quot;,
      &quot;@types/lodash&quot;: &quot;4.14.160&quot;,
      &quot;@types/mousetrap&quot;: &quot;^1.6.5&quot;,
      &quot;mousetrap&quot;: &quot;^1.6.5&quot;,
      &quot;ag-grid-angular&quot;: &quot;^25.0.1&quot;,
      &quot;ag-grid-community&quot;: &quot;^25.0.1&quot;,
      &quot;angular-tree-component&quot;: &quot;^8.5.6&quot;,
      &quot;angular2-csv&quot;: &quot;^0.2.9&quot;,
      &quot;core-js&quot;: &quot;^3.8.3&quot;,
      &quot;font-awesome&quot;: &quot;^4.7.0&quot;,
      &quot;lodash&quot;: &quot;^4.17.15&quot;,
      &quot;ng-http-loader&quot;: &quot;^9.1.0&quot;,
      &quot;ngrx-store-localstorage&quot;: &quot;^10.1.2&quot;,
      &quot;ngx-clipboard&quot;: &quot;^14.0.1&quot;,
      &quot;primeicons&quot;: &quot;^4.1.0&quot;,
      &quot;primeng&quot;: &quot;^11.2.0&quot;,
      &quot;reselect&quot;: &quot;^4.0.0&quot;,
      &quot;rxjs&quot;: &quot;~6.6.0&quot;,
      &quot;rxjs-compat&quot;: &quot;~6.6.0&quot;,
      &quot;tslib&quot;: &quot;^2.0.0&quot;,
      &quot;zone.js&quot;: &quot;~0.11.3&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@angular-devkit/build-angular&quot;: &quot;~0.1102.1&quot;,
      &quot;@angular/cli&quot;: &quot;~11.2.1&quot;,
      &quot;@angular/compiler-cli&quot;: &quot;~11.2.1&quot;,
      &quot;@types/jasmine&quot;: &quot;~3.6.0&quot;,
      &quot;@types/node&quot;: &quot;^12.11.1&quot;,
      &quot;codelyzer&quot;: &quot;^6.0.0&quot;,
      &quot;jasmine-core&quot;: &quot;~3.6.0&quot;,
      &quot;jasmine-spec-reporter&quot;: &quot;~5.0.0&quot;,
      &quot;karma&quot;: &quot;~5.2.0&quot;,
      &quot;karma-chrome-launcher&quot;: &quot;~3.1.0&quot;,
      &quot;karma-coverage&quot;: &quot;~2.0.3&quot;,
      &quot;karma-jasmine&quot;: &quot;~4.0.0&quot;,
      &quot;karma-jasmine-html-reporter&quot;: &quot;^1.5.0&quot;,
      &quot;protractor&quot;: &quot;~7.0.0&quot;,
      &quot;ts-node&quot;: &quot;~8.3.0&quot;,
      &quot;tslint&quot;: &quot;~6.1.0&quot;,
      &quot;typescript&quot;: &quot;~4.1.2&quot;,
      &quot;ngrx-store-logger&quot;: &quot;^0.2.4&quot;,
      &quot;webpack&quot;: &quot;^4.39.1&quot;
    }
  }
  </code></pre>
  <p>tsconfig.json</p>
  <pre><code>{
    &quot;compileOnSave&quot;: false,
    &quot;compilerOptions&quot;: {
      &quot;outDir&quot;: &quot;./dist/out-tsc&quot;,
      &quot;baseUrl&quot;: &quot;src&quot;,
      &quot;sourceMap&quot;: true,
      &quot;declaration&quot;: false,
      &quot;downlevelIteration&quot;: true,
      &quot;moduleResolution&quot;: &quot;node&quot;,
      &quot;emitDecoratorMetadata&quot;: true,
      &quot;experimentalDecorators&quot;: true,
      &quot;target&quot;: &quot;es5&quot;,
      &quot;module&quot;: &quot;esnext&quot;,
      &quot;typeRoots&quot;: [
        &quot;node_modules/@types&quot;
      ],
      &quot;lib&quot;: [
        &quot;es2018&quot;,
        &quot;dom&quot;
      ]
      
    },
    &quot;angularCompilerOptions&quot;: {
      &quot;enableI18nLegacyMessageIdFormat&quot;: false
    }
  }
  </code></pre>
  <p>Any idea what could be wrong?</p>