Custom decorators are stripped when using the ng build --prod
Even standard decorators are removed. ng build --prod Please remove the deletion
Probably related https://github.com/angular/angular-cli/issues/8725
I think this has something to do with @angular-devkit/build-optimizer but it supposedly should preserve the non-angular decorators?
Scrub file
Angular decorators, property decorators and constructor parameters are removed, while leaving non-Angular ones intact.
Possible workaround, try running with --no-build-optimizer.
It is intentional that Angular decorators are removed. What other decorators are you seeing removed? Can you tell me how to repro?
Flag the flag helped --no-build-optimizer, I use JitCompilerFactory, styles and templates are not loaded. But they are not needed. I learned to take ViewCalss and renderType from AOT EntryComponets.
The request can be closed. Thank you very much
@filipesilva when this is intentional what is the best way how to keep metadata after its compiled? In previous version all used to worked me where I updated loader.js and added tstickle style-like static properties to keep the metadataabout @Input,@output. Now when you introduce this full removal all starts again.
Cant you simply make it configurable so developers can specify what should be removed and what its not?
I can see the removeDecorator transformer is called before loader.js which before converted ctordecorator to static fields and now since we call remove decorator after all code in there is obsolete.
I need probably move my code that converts @Input,@Output into propDecorators into makeDecorators, before the removal is called.
https://github.com/angular/angular-cli/issues/8997#issuecomment-354015987
Again disappeared decoratoes
@angular/cli": "1.6.2"
the flag --no-build-optimizer does not work
I am used ./node_modules/.bin/ng build --prod --no-build-optimizer
--no-build-optimizer not working in @angular/cli:1.6.2. But if use @angular/cli:1.5.0 then all Ok
repo for reproduce https://github.com/Alekcei/no-build-optimizer
contains two projects differing "@angular/cli": "1.5.0" and "@angular/cli": "1.6.2"
testngcli150 works, the components are displayed
testngcli162 not working, the components are don`t displayed
comand build ./node_modules/.bin/ng build --prod --no-build-optimizer
Please see the problem Flag no-build-optimizer stopped working
As @filipesilva stated above, AOT mode removes Angular decorators from the application code and this behavior is intentional. Not removing the decorators results in larger output bundles and slower production build times. The build optimizer is primarily responsible for library optimization and is not relevant to application decorator removal (it was erroneously in 1.5).
If custom (non-Angular decorators) are observed to be removed then this would indeed be a defect. In that case, please re-open the issue.
If the capability to keep Angular decorators in AOT mode is desired, then please consider opening a feature request. Please note, however, this does not guarantee that the feature will be implemented.
The flag was entered --no-build-optimizer, disabling optimization, now it does not work
All decorators are deleted
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.