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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular cli - not removing dependencies of unused library modules / components #14052

Closed
yansokalau opened this issue Apr 2, 2019 · 10 comments
Closed

Comments

@yansokalau
Copy link

馃悶 Bug report

Command (mark with an x)

- [ ] new
- [x ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

The BUG is presented in previous version as well.

Description

Unused (not imported) modules of angular library are included to build made in production mode. Everything is generated by cli, nothing were changed manually. Reproduction is below.

馃敩 Minimal Reproduction

https://github.com/yansokalau/angular-library-test project where the issue can be reproduced, steps are described here

馃實 Your Environment


@angular-devkit/architect         0.7.5
@angular-devkit/build-angular     0.7.5
@angular-devkit/build-optimizer   0.7.5
@angular-devkit/build-webpack     0.7.5
@angular-devkit/core              0.8.9
@angular-devkit/schematics        0.8.9
@angular/cdk                      7.3.0
@angular/cli                      7.0.7
@angular/material                 7.3.0
@angular/pwa                      0.8.9
@ngtools/webpack                  6.1.5
@schematics/angular               0.8.9
@schematics/update                0.10.7
rxjs                              6.4.0
typescript                        3.1.6
webpack                           4.9.2

Please let me know if more information is required. Thank you.

@yansokalau
Copy link
Author

yansokalau commented Apr 2, 2019

@filipesilva linked isue is #13082
Didn't get response there so creating a separate one.

@filipesilva
Copy link
Contributor

Hey @yansokalau I did see you added a repro to #13082 but haven't had time to look into it to see if it's the same as #13082 (comment).

@filipesilva filipesilva added needs: investigation Requires some digging to determine if action is needed area: devkit/build-angular labels Apr 2, 2019
@ngbot ngbot bot added this to the needsTriage milestone Apr 2, 2019
@alan-agius4
Copy link
Collaborator

Also related to: #13635

@yansokalau
Copy link
Author

Hello @filipesilva,
Any updates?

@dadoadk
Copy link

dadoadk commented Jun 17, 2019

Any progress on this topic? Working a library where developers can pick and choose what to import without bunding the entire list of components they might never use. This issue is kind of a big deal.

@admir86
Copy link

admir86 commented Sep 12, 2019

can we expect a fix of this before v9 (before ivy)?
In my monorepo where I have four libs, the output of some apps is immense, because the app is using from each lib one or more component or services and finally I have all the libs (the whole lib) in my bundle

@clydin
Copy link
Member

clydin commented Sep 12, 2019

Upon examination of the reproduction, it appears that the vendorChunk option was enabled in the production configuration for the application (link). This option is intentionally disabled for production builds. The underlying bundler (Webpack) cannot perform an overwhelming majority of its optimizations with this setting enabled. The vendorChunk option is only intended to be used for development scenarios to minimize rebuild time in watch or serve mode.

By reverting the option to its original state of disabled, the problem described is no longer present.

Closing the issue as this appears to be a project configuration issue rather than a systemic defect. If anyone is encountering similar issues but not related to the vendorChunk option, please open a new issue describing the problem and providing a minimal reproduction where possible.

@clydin clydin closed this as completed Sep 12, 2019
@clydin clydin removed the needs: investigation Requires some digging to determine if action is needed label Sep 12, 2019
@VladislavLobakh
Copy link

@clydin It's just a simple example. The issue is not related to vendorChunk, because we're using false in our project.

Screen Shot 2019-09-13 at 12 32 35

@clydin
Copy link
Member

clydin commented Sep 13, 2019

The issue as reported was due to the option and the example demonstrated this. As noted above, if anyone is encountering issues not related to the option, please open a new issue with details and a minimal reproduction. Also please ensure the latest actively supported version of the CLI is used as any issue encountered may already have been corrected.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants