I have deployed my Angular website on GitHub page, but I got a problem.
The below is my route setting:
const routes: Routes = [
{ path: '', redirectTo: 'main', pathMatch: 'full' },
{ path: 'main', component: AppMainComponent }
];
The below is my deployment commands:
- name: Build
run: |
npm install -g @angular/cli
npm install
ng build --prod --base-href=https://[user-name].github.io/[project-name]/
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_BRANCH: master
BRANCH: gh-pages
FOLDER: dist/[project-name]
If I go to my GitHub page, "https://[user-name].github.io/[project-name]/", it worked fine and redirected to "https://[user-name].github.io/[project-name]/main" successfully. But after I clicked reload button of the browser, it showed 404 page not found to me.
My Angular version is 9.1.8.
Thanks!