You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Angular 5.1.0 with typescript 2.5.x does not emit extra decorators with ngc #20864
ngc command does not emit extra decorators with Angular 5.1.0 and typescript 2.5.3
Expected behavior
it should emit decorators as it did with Angular 5.0.x and typescript 2.4.2
Minimal reproduction of the problem with instructions
create a custom typescript decorator and add this to a Angular component and try compiling using ngc. it won't emit the custom decorator with the output.
ex:
What is the motivation / use case for changing the behavior?
we have number of libraries internally using and build through angular ngc command for umd support (similar to angular package build commands). we are not able to update to Angular 5.1.0 with above bundle process does not emit decorators anymore.
Environment
Angular version: 5.1.0
Typescript: 2.5.x
Reacted by Alexander Turtsevich and Code Scratcher
while debugging this issue, i am seeing that having both @Component and @EntryComponent decorators doesn't emit the EntryComponent decorator while compiling. if i remove 1 other gets compiled. looks like new compiler doesn't compile multiple decorators
changed the title [-]Angular 5.1.0 with typescript 2.5.x does not emit decorators with ngc[/-][+]Angular 5.1.0 with typescript 2.5.x does not emit extra decorators with ngc[/+]on Dec 7, 2017
@mlakmal ... yes, bundling individual files but for compiling it doesn't matter. In my test case I have @Component & custom @Timeout decorators together and as you can see above they are not removed.
Activity
mlc-mlapis commentedon Dec 7, 2017
@mlakmal ... do you mean
AppComponent.decorators = [...]orAppModule.decorators = [...]in compiled JS files?mlakmal commentedon Dec 7, 2017
below is v5.0.5 output which includes custom decorator (EntryComponent). this is getting stripped with 5.1.0
mlc-mlapis commentedon Dec 7, 2017
@mlakmal ... hmm, I have it with Angular 5.1.0 and TS 2.5.3 & AOT ... here for
@Timeout(2000):mlc-mlapis commentedon Dec 7, 2017
@mlakmal ... are you sure that you compile with TS 2.5.3 and not with TS 2.6?
mlakmal commentedon Dec 7, 2017
@mlc-mlapis are you using angular cli ? i am directly using ngc command to create umd bundle
yes i am using 2.5.x typescript
mlc-mlapis commentedon Dec 7, 2017
@mlakmal ... yes, directly ngc to create bundles also ...
mlakmal commentedon Dec 7, 2017
@mlc-mlapis can you share your tsconfig if possible ? i am using below which is simillar to angular project build configs.
main config
package config
mlc-mlapis commentedon Dec 7, 2017
@mlakmal ... and my is:
mlakmal commentedon Dec 7, 2017
@mlc-mlapis looks like you are bundling individual files instead of umd bundle for esm5/esm2015 ?
when i tried your config i would not be able to setup esm5/esm2015 bundle etc ...
mlakmal commentedon Dec 7, 2017
while debugging this issue, i am seeing that having both
@Componentand@EntryComponentdecorators doesn't emit the EntryComponent decorator while compiling. if i remove 1 other gets compiled. looks like new compiler doesn't compile multiple decorators[-]Angular 5.1.0 with typescript 2.5.x does not emit decorators with ngc[/-][+]Angular 5.1.0 with typescript 2.5.x does not emit extra decorators with ngc[/+]mlc-mlapis commentedon Dec 7, 2017
@mlakmal ... yes, bundling individual files but for compiling it doesn't matter. In my test case I have
@Component& custom@Timeoutdecorators together and as you can see above they are not removed.kemsky commentedon Dec 7, 2017
Probably i have the same issue, i have custom decorator and
@Injectable(), will check ngc output.mlc-mlapis commentedon Dec 7, 2017
@mlakmal ... I tried to change to:
and decorators are still here when ngc compiles the sources:
kemsky commentedon Dec 7, 2017
Single custom
Apidecorator:Two decorators,
ApiandInjectable:TypeScript 2.5.3, Angular 5.1.0, "module": "es2015"
15 remaining items
test(compiler): reproduction for issue angular#20864
alxhub commentedon Dec 12, 2017
Reproduced in an
ngctest: alxhub@b4835e3chuckjaz commentedon Dec 15, 2017
This appears to be a bug in Tsickle's decorator down-leveling which I reported here angular/tsickle#674.
I will submit a PR to fix this in the Tsickle repository.
I will leave this bug open to track when Angular is update to use the corrected version of Tsickle
chuckjaz commentedon Dec 15, 2017
Reopening. This was automatically closed when the Tsickle change committed.
chuckjaz commentedon Dec 22, 2017
This is fixed by [email protected]
angular-automatic-lock-bot commentedon Sep 13, 2019
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.