I\'m building an application using Angular paired with Angular Material, and I\'m having some issues with my modules structure.
As the guidelines suggest, importing
Depending on your compiling and deployment strategy you'll want to use tree shaking (for dead-code elimination or live-code import). This is the main motivation for MaterialModule
being deprecated. The official suggestion is to only import the components you need in the modules that need it. Your solution of creating a single MaterialModule
with all the imports is undoing that aspect but might work depending on your project structure (if you're only using a single module for example).
Try removing MaterialModule
from your SharedModule
exports. That way you only have a single point of entry for the module in your app root.