Получение ошибки Angular при горячей перезагрузке сервера веб-пакетов в консоль браузера только для jhipster, а не при другой компиляции - PullRequest
0 голосов
/ 16 февраля 2020

У меня настроен отладчик, настроенный в соответствии с инструкцией jHipster https://www.jhipster.tech/development/ с прокси-сервером webpack и broswersink. Серверная сторона работает нормально, файлы stati c хорошо извлекаются из него и могут запрашиваться на localhost:9000 и localhost:9060, но не на самом приложении angular, когда вызывается localhost:9000/ или localhost:9000/api на вкладке браузера под browsersynk. Я показываю мне ошибку в консоли браузера следующим образом:

Error: Invalid configuration of route 'teacher/class/:id'. One of the following must be provided: component, redirectTo, children or loadChildren
    at validateNode (router.js?6580:607)
    at validateConfig (router.js?6580:577)
    at validateNode (router.js?6580:623)
    at validateConfig (router.js?6580:577)
    at Router.resetConfig (router.js?6580:4111)
    at new Router (router.js?6580:3779)
    at setupRouter (router.js?6580:5591)
    at _callFactory (core.js?09c9:18520)
    at _createProviderInstance (core.js?09c9:18466)
    at initNgModule (core.js?09c9:18396)

И это не указывает почти на те же маршруты, настроенные в том же файле. Я понятия не имел, что не так с этим указанным c маршрутом.

В одном месте у меня есть пара настроенных маршрутов:

import { Route, Routes } from '@angular/router';

import { CreateKindergartenclassComponent } from 'app/businesslogic';
import { DetailKindergartenclassComponent } from 'app/businesslogic';
import { ListKindergartenclassComponent } from 'app/businesslogic';
import { SelectKindergartenclassComponent } from 'app/businesslogic';
import { UserRouteAccessService } from 'app/core';
import { KindergartenClassResolve } from 'app/entities/kindergarten-class';
import { CommentResolve } from 'app/entities/comment';

export const createKindergartenclassRoute: Route = {
  path: 'teacher/class/create',
  component: CreateKindergartenclassComponent,
  data: {
    authorities: ['ROLE_TEACHER_PAID'],
    pageTitle: 'businesslogic.create.kindergartenclass.title'
  },
  canActivate: [UserRouteAccessService]
};

export const detailKindergartenclassRouteChild: Route = {
  path: 'child/class/:id',
  component: DetailKindergartenclassComponent,
  data: {
    authorities: ['ROLE_CHILD_PAID'],
    pageTitle: 'businesslogic.kindergartenclass.title'
  },
  resolve: {
    kindergartenClass: KindergartenClassResolve
  },
  canActivate: [UserRouteAccessService]
};

export const detailKindergartenclassRouteTeacher: Route = {
  path: 'teacher/class/:id',
  component: DetailKindergartenclassComponent,
  data: {
    authorities: ['ROLE_TEACHER_PAID'],
    pageTitle: 'businesslogic.kindergartenclass.title'
  },
  resolve: {
    kindergartenClass: KindergartenClassResolve
  },
  canActivate: [UserRouteAccessService]
};

export const listKindergartenclassRoute: Route = {
  path: 'teacher/classes',
  component: ListKindergartenclassComponent,
  data: {
    authorities: ['ROLE_TEACHER_PAID'],
    pageTitle: 'businesslogic.list.kindergartenclass.title'
  },
  resolve: {
    kindergartenClass: KindergartenClassResolve
  },
  canActivate: [UserRouteAccessService]
};

export const listKindergartenclassRouteChild: Route = {
  path: 'child/classes',
  component: ListKindergartenclassComponent,
  data: {
    authorities: ['ROLE_CHILD_PAID'],
    pageTitle: 'businesslogic.list.kindergartenclass.title'
  },
  resolve: {
    kindergartenClass: KindergartenClassResolve
  },
  canActivate: [UserRouteAccessService]
};

export const selectKindergartenclassRoute: Route = {
  path: 'child/select',
  component: SelectKindergartenclassComponent,
  data: {
    authorities: ['ROLE_CHILD_PAID'],
    pageTitle: 'businesslogic.list.kindergartenclass.title'
  },
  resolve: {
    kindergartenClass: KindergartenClassResolve
  },
  canActivate: [UserRouteAccessService]
};

export const listKindergartenclassCommentPopupRoute: Route = {
  path: 'teacher/classes/:id/delete',
  component: ListKindergartenclassComponent,
  resolve: {
    comment: CommentResolve
  },
  data: {
    authorities: ['ROLE_USER', 'ROLE_TEACHER_PAID'],
    pageTitle: 'mentalApp.comment.home.title'
  },
  canActivate: [UserRouteAccessService]
};

export const listKindergartenclassCommentPopupRouteChild: Route = {
  path: 'child/classes/:id/delete',
  component: ListKindergartenclassComponent,
  resolve: {
    comment: CommentResolve
  },
  data: {
    authorities: ['ROLE_USER', 'ROLE_CHILD_PAID'],
    pageTitle: 'mentalApp.comment.home.title'
  },
  canActivate: [UserRouteAccessService]
};

1 Ответ

0 голосов
/ 17 февраля 2020

Мне до сих пор неясно, почему, но все стало работать в браузере c после того, как я разбил большой код *.route.ts на несколько:

import { Route, Routes } from '@angular/router';

import {
  CreateKindergartenclassComponent,
  DetailKindergartenclassComponent,
  ListKindergartenclassComponent,
  SelectKindergartenclassComponent
} from 'app/businesslogic';
import { UserRouteAccessService } from 'app/core';
import { KindergartenClassResolve } from 'app/entities/kindergarten-class';
import { CommentResolve } from 'app/entities/comment';

export const createKindergartenclassRoute: Route = {
  path: 'teacher/class/create',
  component: CreateKindergartenclassComponent,
  data: {
    authorities: ['ROLE_TEACHER_PAID'],
    pageTitle: 'businesslogic.create.kindergartenclass.title'
  },
  canActivate: [UserRouteAccessService]
};

и

import { Route, Routes } from '@angular/router';

import {
  CreateKindergartenclassComponent,
  DetailKindergartenclassComponent,
  ListKindergartenclassComponent,
  SelectKindergartenclassComponent
} from 'app/businesslogic';
import { UserRouteAccessService } from 'app/core';
import { KindergartenClassResolve } from 'app/entities/kindergarten-class';
import { CommentResolve } from 'app/entities/comment';

export const listKindergartenclassCommentPopupRoute: Route = {
  path: 'teacher/classes/:id/delete',
  component: ListKindergartenclassComponent,
  resolve: {
    comment: CommentResolve
  },
  data: {
    authorities: ['ROLE_USER', 'ROLE_TEACHER_PAID'],
    pageTitle: 'mentalApp.comment.home.title'
  },
  canActivate: [UserRouteAccessService]
};

export const listKindergartenclassCommentPopupRouteChild: Route = {
  path: 'child/classes/:id/delete',
  component: ListKindergartenclassComponent,
  resolve: {
    comment: CommentResolve
  },
  data: {
    authorities: ['ROLE_USER', 'ROLE_CHILD_PAID'],
    pageTitle: 'mentalApp.comment.home.title'
  },
  canActivate: [UserRouteAccessService]
};

и

import { Route, Routes } from '@angular/router';

import {
  CreateKindergartenclassComponent,
  DetailKindergartenclassComponent,
  ListKindergartenclassComponent,
  SelectKindergartenclassComponent
} from 'app/businesslogic';
import { UserRouteAccessService } from 'app/core';
import { KindergartenClassResolve } from 'app/entities/kindergarten-class';
import { CommentResolve } from 'app/entities/comment';

export const detailKindergartenclassRoute: Route = {
  path: 'teacher/class/:id',
  component: DetailKindergartenclassComponent,
  data: {
    authorities: ['ROLE_TEACHER_PAID'],
    pageTitle: 'businesslogic.kindergartenclass.title'
  },
  resolve: {
    kindergartenClass: KindergartenClassResolve
  },
  canActivate: [UserRouteAccessService]
};

export const detailKindergartenclassRouteChild: Route = {
  path: 'child/class/:id',
  component: DetailKindergartenclassComponent,
  data: {
    authorities: ['ROLE_CHILD_PAID'],
    pageTitle: 'businesslogic.kindergartenclass.title'
  },
  resolve: {
    kindergartenClass: KindergartenClassResolve
  },
  canActivate: [UserRouteAccessService]
};

и

import { Route, Routes } from '@angular/router';

import {
  CreateKindergartenclassComponent,
  DetailKindergartenclassComponent,
  ListKindergartenclassComponent,
  SelectKindergartenclassComponent
} from 'app/businesslogic';
import { UserRouteAccessService } from 'app/core';
import { KindergartenClassResolve } from 'app/entities/kindergarten-class';
import { CommentResolve } from 'app/entities/comment';

export const listKindergartenclassRoute: Route = {
  path: 'teacher/classes',
  component: ListKindergartenclassComponent,
  data: {
    authorities: ['ROLE_TEACHER_PAID'],
    pageTitle: 'businesslogic.list.kindergartenclass.title'
  },
  resolve: {
    kindergartenClass: KindergartenClassResolve
  },
  canActivate: [UserRouteAccessService]
};

export const listKindergartenclassRouteChild: Route = {
  path: 'child/classes',
  component: ListKindergartenclassComponent,
  data: {
    authorities: ['ROLE_CHILD_PAID'],
    pageTitle: 'businesslogic.list.kindergartenclass.title'
  },
  resolve: {
    kindergartenClass: KindergartenClassResolve
  },
  canActivate: [UserRouteAccessService]
};

и

import { Route, Routes } from '@angular/router';

import {
  CreateKindergartenclassComponent,
  DetailKindergartenclassComponent,
  ListKindergartenclassComponent,
  SelectKindergartenclassComponent
} from 'app/businesslogic';
import { UserRouteAccessService } from 'app/core';
import { KindergartenClassResolve } from 'app/entities/kindergarten-class';
import { CommentResolve } from 'app/entities/comment';

export const selectKindergartenclassRoute: Route = {
  path: 'child/select',
  component: SelectKindergartenclassComponent,
  data: {
    authorities: ['ROLE_CHILD_PAID'],
    pageTitle: 'businesslogic.list.kindergartenclass.title'
  },
  resolve: {
    kindergartenClass: KindergartenClassResolve
  },
  canActivate: [UserRouteAccessService]
};

все еще Angular волхвов c для меня, и я до сих пор не знаю какое конкретное расщепление добилось цели.

...