2

Scully 找不到我的应用程序的路线,我的路线有问题吗?

我在 scully 版本 0.0.19

app.routing.ts 看起来像这样:

export const routes: Routes = [

  {
    path: '',
    loadChildren: () => import('@travel/home/home.module').then(m => m.HomeModule),
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes, {
    useHash: false,
    anchorScrolling: 'enabled',
    scrollPositionRestoration: 'enabled',
    onSameUrlNavigation: 'reload',
    enableTracing: false,
  })],
  exports: [RouterModule],
  providers: [MainResolver],
})
export class AppRoutingModule {
}

在 home.routing.ts 我有几条子路线:

export const routes: Routes = [
  {
    path: '',
    component: HomeComponent,
    resolve: {
      response: LandingCampaignResolver,
      rkt: RktCookieResolver
    },
    children: [
      {
        path: '',
        loadChildren: () => import('@travel/home/header/header.module').then(m => m.HeaderModule),
      },
      {
        path: 'destino/:landing',
        loadChildren: () => import('@travel/home/landing-campaign/landing-campaign.module').then(m => m.LandingCampaignModule),
        data: {
          title: 'Perguntas Frequentes ',
          description: 'Perguntas frequentes sobre o seu seguro viagem. Tipos e valores de coberturas inclusas, problemas com bagagens, assistência seguro e mais. Accesse aqui!\n',
          keywords: ''
        },
        resolve: {
          response: LandingCampaignResolver
        }
      },
      {
        path: 'Sinistros',
        loadChildren: () => import('@travel/home/sinisters/sinisters.module').then(m => m.SinistersModule)
      },
      {
        path: 'DicasViagem',
        loadChildren: () => import('@travel/home/about-travel-insurance/about-travel-insurance.module').then(m => m.AboutTravelInsuranceModule)
      },
      {
        path: 'Ajuda',
        loadChildren: () => import('@travel/home/contact-us-section/contact-us.module').then(m => m.ContactUsSectionModule)
      },
... more routes like these

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
  providers: [DataPolicyGuard, UdeResponseResolver, LandingCampaignResolver, RktCookieResolver]
})
export class HomeRoutingModule {
}

我也尝试了正常的路径语法而不是打字稿@ one

提前致谢!

角度版本:

Angular CLI: 9.0.0-rc.10
Node: 12.14.1
OS: win32 x64

Angular: 9.0.0-rc.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.0-rc.10
@angular-devkit/build-angular      0.900.0-rc.10
@angular-devkit/build-optimizer    0.900.0-rc.10
@angular-devkit/build-webpack      0.900.0-rc.10
@angular-devkit/core               8.1.3
@angular-devkit/schematics         8.1.3
@angular/cdk                       9.0.0-rc.8
@angular/cli                       9.0.0-rc.10
@angular/flex-layout               7.0.0-beta.24
@angular/http                      7.2.15
@angular/material                  9.0.0-rc.8
@angular/material-moment-adapter   9.0.0-rc.8
@angular/pwa                       0.801.3
@ngtools/webpack                   9.0.0-rc.10
@schematics/angular                8.1.3
@schematics/update                 0.900.0-rc.10
rxjs                               6.5.4
typescript                         3.7.5
webpack                            4.41.2

错误

 npm run scully --showGuessError

 ☺   Started servers in background
servers available
Finding all routes in application.

We encountered a problem while reading the routes from your applications source.
This might happen when there are lazy-loaded routes, that are not loaded,
Check the routes in your app, rebuild and retry.
(You can inspect the error by passing the --showGuessError flag

When there are extraRoutes in your config, we will still try to render those.

We did not find an empty route ({path:'', component:rootComponent}) in your app.
This means that the root of your application will be you normal angular app, and
is not rendered by Scully
In some circumstances this can be cause because a redirect like:
   ({path: '', redirectTo: 'home', pathMatch: 'full'})
is not picked up by our scanner.

By adding '' to the extraRoutes array in the scully.config option, you can bypass this issue

No routes found in application, are you sure you installed the router? Terminating.
npm ERR! code ELIFECYCLE
npm ERR! errno 15
npm ERR! crux-frontend@0.2.3 scully: `scully`
npm ERR! Exit status 15
4

0 回答 0