Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modules optimization #287

Closed
ilianiv opened this issue Jan 25, 2017 · 2 comments
Closed

Modules optimization #287

ilianiv opened this issue Jan 25, 2017 · 2 comments
Labels
Milestone

Comments

@ilianiv
Copy link

ilianiv commented Jan 25, 2017

Feature Request

Decrease imported components from Covalent modules by importing only material modules that are necessary but not the whole MaterialModule.forRoot()

Screenshots or link to CodePen/Plunker/JSfiddle

Here is an example. I do not import/use material in my app at all. I import just Covalent steps module and the result is 64KB for Covalent steps and 745KB for material in my bundle.
I understand that steps module uses some material components but I'm pretty sure that input, slider, dialog and many more material components is not used in Covalent steps component.
steps

What is the expected behavior?

Import only necessary material modules (like MdCheckboxModule or MdButtonModule and so on) in Covalent component's modules but not the whole module MaterialModule.forRoot().

What is the motivation / use case for changing the behavior?

Using Covalent component bloats my bundle size with >700K because of including all material components in it.

Which version of Angular and Material, and which browser and OS does this issue affect?

All

@emoralesb05
Copy link
Contributor

There seems to be issues with ng2 and webpack that conflict with the tree shaking of the prod build.

angular/angular-cli#2901
webpack/webpack#2899

This is the reason we didnt care, since one of the aspects of angular and webpack is that it should remove all unused dependencies when building.

@emoralesb05
Copy link
Contributor

There seems to be a loooong discussion regarding how to fix this since its an IIFE issue with the bundlers.. so we might have to just add the wanted modules like you said.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants