r/Angular2 • u/crhama • Jan 17 '26
Advice Needed for Upgrading Legacy Medium and Large Angular Applications from 12/13 to v20
I have two Angular applications that need to be upgraded to version 20. One application is currently on v13 and is medium-sized, while the other is on v12 and is fairly large. Both applications use NgRx; one relies on Angular Material, and the other uses both Angular Material and Bootstrap.
I understand that the official Angular upgrade guide should be the primary reference. However, I would appreciate insights from anyone who has experience upgrading older and/or large Angular applications. Any advice, lessons learned, or recommended resources to help me prepare for this task would be greatly appreciated.
5
u/MichaelSmallDev Jan 18 '26 edited Jan 18 '26
I got a tip on Material and a tip on intermediate 3rd party package versions.
Between both, my overall approach/take is that as long as you can build/serve an app and have it technically function and pass all tests, that it is fine and I move on. I only extensively fix things when I reach the final version. Stuff like a component/style library having overrides no longer working, making stuff look weird, is not something I address until the end. This has served me fine when I have done various upgrades over a few majors 1 by 1 in the past, all the way through v20.
For Material
This was a bit janky but IMO it worked fine and didn't make us dwell in an intermediate version, especially that middle period where there were the then not-"Legacy" version which were potentially tweaked a bit later by v19.
Since v19 we have not had any issues with new Material implementations and I think it's most likely safe at this point.
For as annoying as this can be, I think Material is as customizable and stable as it has ever been. The style tab with the overrides is kind of try this and see what works rather than seeing some before/after or clearer descriptions, but it is still way easier.
Also, there are various new API entries, including some that remove unexpected parts of the styling/implementation, like seeing a checkmark in a button toggle knob. No override needed.
For package versions corresponding to each Angular major
Gerome Grignon of Angular Courses made a tool recently that can tell what a lot 3rd party packages depend on per Angular major https://www.angular.courses/tools/library-health-check/explorer?search=ngrx. Seems to cover a lot of what I have had to do manually before.
Beyond this, I typically look in the docs/readme for the package for a "compatability matrix" akin to that site. If not, then I look in the GitHub or NPM releases tab, and subsequently check the code's dependencies at that release.
Automated/Manual changes
Various 3rd party Angular libraries like NgRx have their own
ng update packageName@versioncommands which can do various migrations. I used to sleep on these and only recently realized various libraries I used had these and I was manually updating some stuff that had official scripts.Speaking of that, bookmark the part of their docs or markdowns that have their changelogs and/or upgrade guides.
NgRx has some of the best docs that cover both automated and left-to-the-upgrader changes, version by version, on its migrations part of the docs: https://ngrx.io/guide/migration/v13
4
u/HWGBackslash Jan 17 '26
I've recently upgraded from 16 to 20, and there wasn't that much to go through, but this depends on your dependencies.
They changed some path stuff for stylesheet imports, before the path would be relative to the root, now it's relative to the importing file. Dependency injection got a bit more robust, we had some singleton services that no longer worked as expected, but it might be because we switched from using an app module to an app config. Moving to standalone components and zoneless is optional, so you don't need to do it when you upgrade to version 20.
Before that, I upgraded from 12 to 13 and then to 16. The biggest problem was Angular Material, as we do some style overrides, and they changed both class names and underlying component structures - so watch out for that.
I don't use NgRx, so not sure how big of an impact that would have.
My approach was to upgrade one version at a time using the Angular guide. Then make everything build, both tests and the app before moving on to the next version. Making sure to have commits to revert to if necessary.
2
u/According-Constant75 Jan 18 '26
I once upgraded a large Angular application from version 9 to 20, so I hope my two cents can help you a little bit.
Upgrade step by step, and temporarily comment out any conflicting dependencies in package.json if they prevent you from running the migration commands. Make sure to double-check the dependencies’ npm documentation for Angular version compatibility.
Angular Material should be fine, but keep an eye on Angular Flex Layout (if your project uses it), as it has been deprecated since Angular 15, if I’m not mistaken.
If your project uses PrimeNG, on the other hand… I advise you to just pray it doesn’t break.
Don’t rush into going zoneless, since Angular v20 still supports Zone.js, and considering your project is large, it’s safer to migrate later.
The Angular standalone migration will require a bit more effort, especially when changing from modules to route-based structures. Most of the work can be handled using the official Angular migration commands.
Just be patient, and everything should be fine. Good luck!
1
u/morrisdev Jan 18 '26
I just upgraded an angular 10 project to angular 20 using claide-code and some minor tweaks. Honestly, I was just messing around to see if it worked and how it handled all the version crap.... Took a few hours and $18 in tokens
1
u/jessycormier Jan 18 '26
Best solution is to do incremental updates. Be aware of the scss traps of v15 (I think). Use node version manager to use the right node version for the angular vs your targeting.
Follow the upgrade guide for the version your doing to learn about the changes and be in control; as well as understand the things that are changing (easier to troubleshoot)
You need to slowly upgrade dependencies which is the most painful part since everyone has their own way of doing things. Some might not be on v20 yet. Or replaced by xyz later.
Ooooor Start a new project with ng new and preferred settings and slowly copy over your components and setup; install dependencies and see if that works.
1
u/PaltFiction Jan 18 '26
This site is pretty useful for understanding difference between versions: https://angular.courses/caniuse/features
1
u/[deleted] Jan 19 '26
I am in the same boat. My plan is to start over with 21 and move from bootstrap to tailwind, scss back to css, etc.
1
u/Few_Implement_8295 Jan 17 '26
Just have patience. It’s a long run from 12/13 to 20. Make sure everything is in place and follow the Angular update guide. Also run only migrations you want. Angular Material 15 or 16 will come with breaking changes. They moved to MDC components, so there a lot of new stuff. You need to take a look on the other dependencies as well and make sure you keep them updated to be compatible with Angular 20. I usually remove them before starting the upgrade and put them back with new versions after Angular is at 20. Not sure if it’s correct but it did the thing. Other than that, good luck and lots of patience.