-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
🐞 Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- xi18n
- run
- config
- help
- version
- doc
Is this a regression?
No
Description
I understood from the description of the build-optimizer plugin, that non-Angular decorators should not be stripped.
https://www.npmjs.com/package/@angular-devkit/build-optimizer
However, I can see that decorated properties inside the constructor are removed, which prevents my team from using build-optimizer as part of the ng build
command (we use inversifyjs to manage our dependencies outside of the Angular module).
Inside scrub-file.ts
, the isDecorateAssignmentExpression
method seems to be responsible for the decision to strip this metadata.
🔬 Minimal Reproduction
https://github.com/kevindrecruit/angular-build-optimizer-issue
🔥 Exception or Error
Using the minimum reproduction git repository, we can see the following error (which is specific to inversifyjs):
ERROR Error: Missing required @inject or @multiInject annotation in: argument 0 in class e.
The point is that the @inject()
has been removed from the constructor where it is still needed.
🌍 Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 10.0.7
Node: 12.18.3
OS: linux x64
Angular: 10.0.12
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1000.7
@angular-devkit/build-angular 0.1000.7
@angular-devkit/build-optimizer 0.1000.7
@angular-devkit/build-webpack 0.1000.7
@angular-devkit/core 10.0.7
@angular-devkit/schematics 10.0.7
@angular/cli 10.0.7
@ngtools/webpack 10.0.7
@schematics/angular 10.0.7
@schematics/update 0.1000.7
rxjs 6.5.5
typescript 3.9.7
webpack 4.43.0
Anything else relevant?