Angular 8.2 custom decorator bug (related github issue)
When running in prod mode, with a ES2015 target, any custom decorator that is used on an input in a library used by the app will simply be ignored.
This repository contains:
- a library (
src
folder) that provides amy-test
component that used aCustomDecorator
decorator on itsvalue
input, and displays thevalue
- a test app (
test-app
folder) that usesmy-test
by passing it avalue
CustomDecorator
simply overrides the input by making sure it always has the value success
. It also console.log Calling CustomDecorator
when called.
This code should then always display success
<my-test [value]="16"></my-test>
In dev mode, with a ES2015 target, success
is displayed, and Calling CustomDecorator
is displayed in the console.
In prod mode, with a ES5 target, success
is displayed, and Calling CustomDecorator
is displayed in the console.
But, in prod mode, with a ES2015 target, 16
is currently displayed, and Calling CustomDecorator
is not displayed in the console.
Using ng serve
or ng build
doesn't seem to matter.
The bug is not present in Angular 8.0.x or 8.1.x.
npm run build-lib # or npm run watch
npm start -- --prod
Then open http://localhost:3000
npm start
Then open http://localhost:3000
npm run start-es5 -- --prod
Then open http://localhost:3000