Cds Angular Component Imports #6278
-
Hi, On the website, I believe the second approach enhances the developer experience since editors, intellisense and compilers are going to be able to understand this component now, but does it negatively impact performance (Build time and tree shaking)??? Is this technically the same as import What would you guys suggest? Sid |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hi @siddharth1903, The best way is to just use The directives have a selector and define Tree shaking should be fine but if face any unexpected behaviour let us know. |
Beta Was this translation helpful? Give feedback.
-
Okay @bbogdanov ... What do you think about import { CdsSearchModule, CdsFormsModule } from '@cds/angular'; We have libraries using clarity presenters, where we wanna keep the bundle sizes and the build times optimal. The library we have holds components that are built on single responsibility principle. Does the use of individual feature modules like the one i have pointed above help in optimization? Material: |
Beta Was this translation helpful? Give feedback.
-
The basic question of using If you want full control over the optimizations, then you can go with the raw web component imports. Angular can use them just fine if you also use There is no real benefit to importing Generally speaking, |
Beta Was this translation helpful? Give feedback.
The basic question of using
CdsModule
or not depends on if you want to get the compiler guarantees that come with our Angular wrappers. If you import the web components directly, Angular doesn't know their binding options and so you have to basically disable template checking when usingCUSTOM_ELEMENTS_SCHEMA
. I believe this is worse than a few kb extra to includeCdsModule
, but it is a tradeoff.CdsModule
also is tree shakeable, so if you don't use a component Angular CLI will drop it from the bundle.CdsModule
(and all of the individual subcomponents) handle registering the icons used by these components as well, which again helps the developer experience.If you want full control over …