Closed pierresigwalt closed 4 years ago
I can't reproduce your issue. This works already in a lot of projects. Can you provide a reproduction of the issue?
I'm going to close this as there is no added actionable data anymore. When you still have problems, please add it in here and we can reopen.
Hi,
Don't want to reopen it but it may help someone. The issue was not coming from the plugin but from my Angular Project:
Use Case:
AppModule
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterModule } from '@angular/router';
// Modules
import { SharedModule } from '@shared/shared.module';
import { AppRoutingModule } from './app-routing.module';
import { HomeModule } from './home/home.module';
// Components
import { AppComponent } from './app.component';
// Guards
import { LanguageNCountryGuard } from '@guards/language-n-country.guard';
@NgModule({
bootstrap: [AppComponent],
declarations: [AppComponent],
imports: [
AppRoutingModule,
HomeModule,
RouterModule,
SharedModule,
],
providers: [LanguageNCountryGuard],
})
export class AppModule {}
SharedModule
import { CommonModule } from '@angular/common';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
// PIPES
import { SafePipe } from '@shared/pipes/safe.pipe';
// INTERCEPTORS
import { HttpErrorInterceptor } from '@interceptors/http-error.interceptor';
@NgModule({
declarations: [SafePipe],
imports: [
RouterModule,
],
exports: [],
providers: [],
})
export class SharedModule {}
HomeModule
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { SharedModule } from '@shared/shared.module';
import { HomeRoutingModule } from './home-routing.module';
import { HomeComponent } from './home.component';
import { HomebaseComponent } from './homebase/homebase.component';
@NgModule({
declarations: [HomeComponent, HomebaseComponent],
imports: [
HomeRoutingModule,
RouterModule,
SharedModule,
],
})
export class HomeModule {}
As we can see I have imported:
The fix that I have done to remove the error when scanning the route was to remove the import of HomeModule inside AppModule as it was not necessary.
New AppModule
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterModule } from '@angular/router';
// Modules
import { SharedModule } from '@shared/shared.module';
import { AppRoutingModule } from './app-routing.module';
// Components
import { AppComponent } from './app.component';
// Guards
import { LanguageNCountryGuard } from '@guards/language-n-country.guard';
@NgModule({
bootstrap: [AppComponent],
declarations: [AppComponent],
imports: [
AppRoutingModule,
RouterModule,
SharedModule,
],
providers: [LanguageNCountryGuard],
})
export class AppModule {}
Thank you for your help!
@pierresigwalt Thanks for sharing,
🐞 Bug report
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, Or when there are paths we can not resolve statically. Check the routes in your app, rebuild and retry.
Description
I just added Scully to my application but when trying to scan new routes I am getting this error even if the Home Routing Module is only declared in the Home Module.
🔬 Minimal Reproduction
app.routing.modules.ts
💻Your Environment
Angular Version:
Scully Version:
🔥 Exception or Error