Repository navigation
Description
Please provide us with the following information:
OS?
Windows 10
Versions.
angular-cli: 1.0.0-beta.22-1
node: 6.7.0
os: win32 x64
Repro steps.
Suppose there are two nested lazy modules routes like this:
Module A: app-routing.module
`export const routes: Routes = [
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
{ path: 'login', loadChildren: './login/login.module#LoginModule' },
{ path: 'dashboard', loadChildren: './dashboard/dashboard.module#DashboardModule'}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule {}`
Module B (lazy module with another lazy module) dashboard-routing.module:
`const routes: Routes = [
{ path: '', component: DashboardComponent, pathMatch: 'full' },
{ path: 'explotaciones', component: DashboardComponent,
children: [
{ path: '', loadChildren: './explotaciones/explotaciones.module#ExplotacionesModule'}
]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class DashboardRoutingModule {}`
The log given by the failure.
Error: Could not resolve route "./explotaciones/explotaciones.module#ExplotacionesModule" from file "D:\Code\DL-GEST\src\client\app\dashboard\dashboard.module".
at D:\Code\DL-GEST\node_modules@ngtools\webpack\src\plugin.js:280:23
at Array.map (native)
at AotPlugin._processNgModule (D:\Code\DL-GEST\node_modules@ngtools\webpack\src\plugin.js:275:14)
at _loop_1 (D:\Code\DL-GEST\node_modules@ngtools\webpack\src\plugin.js:309:35)
at AotPlugin._processNgModule (D:\Code\DL-GEST\node_modules@ngtools\webpack\src\plugin.js:328:13)
at D:\Code\DL-GEST\node_modules@ngtools\webpack\src\plugin.js:242:39
at process._tickCallback (internal/process/next_tick.js:103:7)
70% building modules 716/716 modules 0 active
Mention any other details that might be useful.
I have been looking for the error and I find a problem in plugin.js. At line 274, this.extractLoading function use a variable called 'relativeModulePath'. With module A, this variable use '/' on paths (D:/Code/DL-GEST/src/client/app/app.module) and there is no problem with it, but with module B, this variable use '\' on path and then, emit error I wrote lines before.
I have changed function var relativeModulePath = this._resolveModulePath(module, containingFile) to
var relativeModulePath = this._resolveModulePath(module, containingFile).replace(/\\/g,'/') and it solves my problems.
Is there a better approach to solve it??
Thanks and excuse my english :).
Thanks! We'll be in touch soon.
Activity
masaanli commentedon Dec 16, 2016
I Have the same issue:
I tried it with just:
A lazy loaded module route and inside that lazy loaded module route a new lazy loaded module route.
It hangs then at 10% module 2/2.
After 10 minutes it throws an error:
10% building modules 2/2 modules 0 active(node:1281) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): RangeError: Maximum ca ll stack size exceeded 20% building modules 84/84 modules 0 activeDestreyf commentedon Dec 17, 2016
@jmpmscorp I can confirm this behavior, and that your fix resolves the issue.
filipesilva commentedon Dec 30, 2016
Marking as dupe of #3663 since it has a bit more discussion.
Destreyf commentedon Dec 30, 2016
@filipesilva This was an issue in beta.22 (more specifically the @ngtools for that release so going back to 21 still had the same issue) this does not affect beta.24, and the fix does not work for beta.24 either. #3663 is a newly introduced problem that prevents nested lazy loading beyond a certain depth.
filipesilva commentedon Dec 30, 2016
Hm, I see. I guess then it's closed as fixed, since it doesn't affect beta.24 and we can't fix the old one anyway.
angular-automatic-lock-bot commentedon Sep 6, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.