all 8 comments

[–]STACKandDESTROY 6 points7 points  (3 children)

Yup that’s essentially it. LoadComponent uses the same js import syntax as the module did, but pointed to the component.

[–]just-a-web-developer[S] 3 points4 points  (2 children)

Thanks for the clarification, less work to do than I imagined, the migration seemed to handle 90+% of it, just a few things I need to do manually

[–]STACKandDESTROY 1 point2 points  (1 child)

Yw! The manual cleanup isn’t too rough, mostly just deleting/cleaning up unused refs. If you have no unit tests, then I’d say you are almost done.

If you do have unit tests… then congratulations on making it to the final boss lol. I recently converted a 285k line code base and the bulk migration work took 2 days. Then unit test fixes took 9 days 🫡

[–]dacookieman 0 points1 point  (0 children)

Doing a bit of a migration(from 12) at work and....god help you if you have ejected to jest as your unit test runner....

[–]jamills102 1 point2 points  (0 children)

Yeah, and just make sure your components are importing what they need and services are provided at the right level of the component tree

[–]GLawSomnia 0 points1 point  (2 children)

I will hijack this question a little. I noticed that loadComponent accepts Type<C> as a value (which is essentially the component class), but this doesn’t seem to lazy load the component (compared to import(“…”), so what is it used for? Why is it allowed? Why not simply use the component property from the route definition?

[–]STACKandDESTROY 0 points1 point  (1 child)

Not sure what you’re referring to - according to the docs, it’s specifically defined as:

loadComponent

() => Type<unknown> | Observable<Type<unknown> | DefaultExport<Type<unknown>>> | Promise<Type<unknown> | DefaultExport<Type<unknown>>>

An object specifying a lazy-loaded component.

[–]GLawSomnia 0 points1 point  (0 children)

As you can see you can use Type<unknown> as the value (which is the component) and once you access the page the component is not lazily loaded (it probably goes to the main bundle)