如何用角处理Heroku中的路由问题?

时间:2019-03-16 22:05:49

标签: node.js angular heroku routing routes

我正在尝试将一个项目以一定的角度部署到heroku,在本地可以正常工作,但是在heroku中我遇到了有关路由的错误:

    ERROR in : Unexpected value '[object Object]' exported by the module 'FeatureRoutingModule in /tmp/build_f3526f025f2ad2799e342a115f1ccdaf/src/app/app.routes.ts'

     chunk {scripts} scripts.1ddbc8b5858d4c91e16d.js (scripts) 281 kB [entry] [rendered]

npm ERR! platon@0.0.0 heroku-postbuild: `ng build --prod`

我的路由代码是:

import { Routes, RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';

import { HomeComponent } from './components/home/home.component';
import { AboutComponent } from './components/about/about.component';
import { ContactComponent } from './components/contact/contact.component';
import { LoginComponent } from './components/login/login.component';
import { RegisterComponent } from './components/register/register.component';

const APP_ROUTES: Routes = [
    { path: 'home', component: HomeComponent },
    { path: 'about', component: AboutComponent },
    { path: 'contact', component: ContactComponent },
    { path: 'register', component: RegisterComponent },
    { path: 'login', component: LoginComponent },
    { path: '**', pathMatch: 'full', redirectTo: 'home' },


];

@NgModule({
    imports: [RouterModule.forChild(APP_ROUTES)],
    exports: [RouterModule, APP_ROUTES]
})
export class FeatureRoutingModule {}

export const APP_ROUTING = RouterModule.forRoot(APP_ROUTES);

0 个答案:

没有答案