I am working on an angular app.
Using
When I executed command
ng build
I did not get any error, but when I tried production build
ng build --prod
I got error
Property 'someProperty' is private and only accessible within class 'SomeComponent'.
Reported error was correct, and I fixed it.
The question is Why dev build did not report this?. Is that a defect in angular-cli OR am I missing something?
Thanks
ng build --prod compile with Ahead of time compilation
. To pass the aot compilation you need to pass your property someProperty
to public
. See this issue on angular-cli
Just for reminder the differences between ng build
and ng build --prod
:
# these are equivalent
ng build --target=production --environment=prod
ng build --prod --env=prod
ng build --prod
# and so are these
ng build --target=development --environment=dev
ng build --dev --e=dev
ng build --dev
ng build
And the default option lunch of --dev
and --prod
flags:
Flag --dev --prod
--aot false true
--environment dev prod
--output-hashing media all
--sourcemaps true false
--extract-css false true
--named-chunks true false
--build-optimizer false true with AOT and Angular 5
Documentation ng build
Hope it's help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With