Open bagbag opened 3 months ago
Hi, could you provide a stackblitz repro or a github repo that exhibits this issue ?
I've created a minimal reproduction: https://github.com/bagbag/angular-decorator-metadata
If you start the application with ng serve
, you will see Design type: String
If you start the application with ng serve --configuration production
, you will see Could not get design type
, as the decorator metadata is not added to the compiled output.
While trying to reproduce this problem I found out, that it only occurs if isolatedModules
is set to true
in tsconfig.
It looks like to be linked to #27752.
Esbuild doesn't generate those metadata.
It looks like to be linked to #27752.
Esbuild doesn't generate those metadata.
Yeah, I suppose the CLI should not use this mode when emitDecoratorMetadata
is enabled.
That said, I wouldn't want to depend on this metadata going forward, as it's currently only supported for the experimental decorators in TS, not the ES standard ones. reference
Additionally, emitDecoratorMetadata
itself has design flaws that can cause it to generate runtime TDZ errors in ES2015+ code. All code generated by the Angular CLI is ES2015+. Angular does not require the use of the option and unless absolutely required by specific project code, the option should ideally be removed.
Which @angular/* package(s) are the source of the bug?
compiler-cli, compiler
Is this a regression?
Yes
Description
Decorator metadata like "design:type" is missing in production builds, while working in development.
Having the following code:
Compiles the to the following in development:
But to the following in production build:
The information about the property
address
being of type String is missing.Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
No response