#Standalone Components and ngStyle

5 messages · Page 1 of 1 (latest)

surreal vapor
#

If I want to use ngStyle or the async pipe in a standalone component, it seems I have to import the CommonModule / NgStyle to that standalone component.

My question is - does Angular compile a copy of the CommonModule in each standalone component that does this? Because we're undergoing a process of converting components to standalone, and actually see the bundle size increasing, not decreasing.

Is there a workaround?

fossil jay
#

I'm more than sure that CommonModule is compiled and loaded once. And other standalone components are just re-using it

#

You can easily test that by creating some lazy loaded components and checking network tab

surreal vapor
#

@Fern You're right, should've done that.
I still notice some standalone components I created are getting duplicated in some bundles though.

#

I see one standalone component in two separate chunks