-
Notifications
You must be signed in to change notification settings - Fork 12k
Lazy loading fails with beta 17 #2678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Route generator seems to not be available with the current version |
However Lazy loading does work in beta.17 , you just have to do it manually. |
In beta-17, you don't start with The change was introduced in 7d7ef21 So, if you write this in your
Note: you'll need to restart |
The change makes sense, but nothing of any variety works whatsoever even after restarting after every change. A few things I just tried: {
path: '',
loadChildren: './hello/hello.module#HelloModule'
}
{
path: '',
loadChildren: './hello/hello.module.ts#HelloModule'
}
{
path: '',
loadChildren: 'hello/hello.module#HelloModule'
}
// Complaints about missing "default", adding it still fails
{
path: '',
loadChildren: './hello/hello.module'
} If I do Cmd + P when in Chrome, I'm getting ngfactory files and no sourcemaps... perhaps it's a bug with AoT being used by default of which doesn't work? I'm serving with: |
Hmm. It should just work with the first variation. Try specifying the output folder specifically. Like Something more aggressive we might try is clear the environment and project.
You might also run Then try again. Other things you can try:First, routing needs a small change to work with AoT, change Second: Does normal loading work?
Ensure you have a |
Tried as you said and got the same: Did you try it? This is on a second laptop and still the same. It doesn't work at all |
I'm sure it works in general, and does not trigger AoT by default. I have created a repo showing it. See @Meligy/routing-angular-cli. If you run AoTAoT compilation still fails. But again, |
AoTThis is the error in the browser that gets shown when running the sample Repro https://github.com/Meligy/routing-angular-cli
This is with beta-17, and with latest git. It's also with Angular packages at 2.0.0, and at 2.1.0 (including @angular/compiler). The repro fixes the build issues (suggested as default in #2680), but the browser error still exists. // cc @filipesilva @Brocco @TheLarkInn sorry for the spam, but you guys were interested in this in one way or another. Let me know if you prefer this to be a new issue and close this one. |
Deeply compared your example to mine and found the issue. import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { LazyComponent } from './lazy.component';
export const routes: Routes = [
{
path: '',
component: LazyComponent
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
providers: []
})
export class LazyRoutingModule { } If you lazily load a module without any routes, that's the error you get. So I guess this issue has nothing to do with angular-cli and can be closed. Not sure if it's as expected in ng2 but a better error would be good :) To elaborate on AOT always being used. If you CMD+P in Chrome to search for source-mapped code, files are suffixed with |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS?
OSX Sierra
Versions.
beta 17
webpack 2.1.0-beta.25
Repro steps.
ng new --routing true r2d2
ng g module hello
The log given by the failure.
Console error:
EXCEPTION: Maximum call stack size exceeded
It's hard to really figure out what's going wrong here. ZoneJS is just swallowing any hope of debugging the cause.
The text was updated successfully, but these errors were encountered: