Search code examples
angulardeploymentbuildproduction

How to identify the following problem given by Angular after production build?


I have a large project in Angular and after production build (ng b --prod) and deployment it shows a white page and the following error:

Uncaught TypeError: Object prototype may only be an Object or null: undefined
    at setPrototypeOf (<anonymous>)
    at i (main.5a0de34ba4bae8cec104.js:1)
    at main.5a0de34ba4bae8cec104.js:1
    at Module.zUnb (main.5a0de34ba4bae8cec104.js:1)
    at f (runtime.26209474bfa8dc87a77c.js:1)
    at Object.1 (main.5a0de34ba4bae8cec104.js:1)
    at f (runtime.26209474bfa8dc87a77c.js:1)
    at t (runtime.26209474bfa8dc87a77c.js:1)
    at Array.r [as push] (runtime.26209474bfa8dc87a77c.js:1)
    at main.5a0de34ba4bae8cec104.js:1

I've published a few other projects like this and didn't have this kind of a problem.


Solution

  • After I updated my project from Angular 7.3.* to Angular 8 and run the following build command

    node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod 
    

    I was able to deploy it successfully.

    Note: I had to set the maximum budget in angular.json also.