After upgrading to Angular 12 ng serve freezes at Generating browser application bundles

Viewed 715

I have an Angular library project that recently got upgraded to v12. After the upgrade building the library and wrapper project work without issue but ng serve gets stuck at Generating browser application bundles (phase: building)...

I have "defaultConfiguration": "development" under the architect - serveenter image description here enter image description here

1 Answers

I experienced similar troubles upgrading to Angular 12. I found another SO post that looked a lot like it : Angular 11 stuck on "Generating browser application bundles (phase: building)"

However, none of the answers did the trick.

Since there is no output message, I am not sure at all that you are facing the same problem as I was, but this might be helpful. I filed a bug here : https://github.com/angular/angular-cli/issues/21971

In my case, the issue seems webpack and tree-shaking related. My Typescript data model contains (a lot of) circular references, though they look quite legit to me. A workaround was to set the sideEffects flag in my package.json file, be it true or false.

{
    "name": "my-app",
    "version": "1.0.0",
    "comment": [
        "This is the package.json file of my app"
    ],
    "private": true,
    "sideEffects": true,
    "dependencies": {},
    "devDependencies": {}
}
Related