79410529

Date: 2025-02-04 03:54:07
Score: 2
Natty:
Report link

After extensive discussion with @dapperdandev, it was noticed the issue seemed to do not with the deployment but with the routing for Angular apps and Github pages.

As per this blog post https://benfraserdesign.medium.com/deploying-an-angular-app-on-github-pages-c4dfee672968, copying the index.html file and naming it 404.html into the docs folder seems to work as a workaround for the issue.

So I updated my build command from:

"build": "ng build --configuration=production --output-path docs --base-href /bible-quiz/ && mv docs/browser/* docs/ && rmdir docs/browser",

to:

"build": "ng build --configuration=production --output-path docs --base-href /bible-quiz/ && mv docs/browser/* docs/ && rmdir docs/browser && cp docs/index.html docs/404.html",

And that fixed the issue.

PS: Other than this, I tried to use hash routing as per:

https://stackoverflow.com/a/75993642/6654475

But that didn't seem to fix it for my case, but maybe would be a better path for a solution if having a 404.html file as a duplicate of the index.html file may not suit your case.

Reasons:
  • Blacklisted phrase (1): this blog
  • Blacklisted phrase (0.5): medium.com
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @dapperdandev
  • Self-answer (0.5):
  • High reputation (-1):
Posted by: Francislainy Campos