Skip to content

lvy:Library build by angular-cli can not tree shaking in apps #34648

Closed
@hpyou

Description

@hpyou

🐞 bug report

Affected Package

@angular/cli

Is this a regression?

it can not work in ng8 also, but i try to ask if it can work in ng9 or not

Description

A library build by angular-cli, improt a module or declare a component of the library into a app, then build the app with aot, the whole library code gets into bundle, the tree shaking did not work

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-srduuh

🔥 Exception or Error

In the demo i use the library jigsaw(https://github.com/rdkmaster/jigsaw) which build by angular-cli

image

and i import the module JigsawButtonModule which just has the component JigsawButton into AppModule

image

if you build the app with this environment,you will get the whole jigsaw code in vender.js

🌍 Your Environment

Angular CLI: 9.0.0-rc.7
Node: 10.18.0
OS: win32 x64

Angular: 9.0.0-rc.7
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.900.0-rc.7
@angular-devkit/build-angular 0.900.0-rc.7
@angular-devkit/build-optimizer 0.900.0-rc.7
@angular-devkit/build-webpack 0.900.0-rc.7
@angular-devkit/core 9.0.0-rc.7
@angular-devkit/schematics 9.0.0-rc.7
@ngtools/webpack 9.0.0-rc.7
@schematics/angular 9.0.0-rc.7
@schematics/update 0.900.0-rc.7
rxjs 6.5.3
typescript 3.6.4
webpack 4.41.2

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions