Thanks @Patryk, your comment helped me to think about one more step.
I am using Firestore as a database. During the firebase init hosting you need to change default settings.
ng build --configuration development
...
firebase init hosting
...
Configure as a single-page app (rewrite all urls to /index.html)?
Simplest way of solving the isse was to answer Yes to the above question during init.
Once I've answered "Y" firebase.json got updated with:
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
and it fixed the issue.