Firebase Hosting and Routes Angular Project don't work

Discussão em 'Angular' iniciado por Valentin Mont, Novembro 2, 2024.

  1. i create a website with Angular. I've finish it and i have deployed it in Firebase Hosting but after deploye i can't navigate in my website. I just have a 404 not found page from firebase hosting. Well when i start my website in localhost i don't have this problem, and i don't know how to solve it...

    My app-routing.module.ts :

    import { CommonModule } from '@angular/common';
    import {RouterModule, Routes} from '@angular/router';
    import {InfoMobileComponent} from './info-mobile/info-mobile.component';
    import {ContactComponent} from './contact/contact.component';

    const routes: Routes = [
    { path: '', redirectTo: '/info', pathMatch: 'full' },
    {
    path: 'info',
    component: InfoMobileComponent
    },
    {
    path: 'contact',
    component: ContactComponent
    },
    ];


    @NgModule({
    declarations: [],
    imports: [
    CommonModule,
    RouterModule.forRoot(routes),
    ],
    exports: [ RouterModule ]
    })
    export class AppRoutingModule { }



    My firebase.json :

    {
    "hosting": {
    "public": "dist",
    "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**"
    ],
    "rewrites": [
    {
    "source": "**",
    "destination": "/index.html"
    }
    ]
    }
    }


    And for information, i build my project to the folder " dist ".

    Continue reading...

Compartilhe esta Página