Skip to content

LazyRoutes Not working any more #3733

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

Closed
monoflash opened this issue Dec 25, 2016 · 18 comments
Closed

LazyRoutes Not working any more #3733

monoflash opened this issue Dec 25, 2016 · 18 comments
Labels
needs: repro steps We cannot reproduce the issue with the information given

Comments

@monoflash
Copy link

in version [email protected] LazyRoutes works fine
in version v1.0.0-beta.22, v1.0.0-beta.23, v1.0.0-beta.24
LazyRoutes Not working anything in the same code! :(

You can test the project?
I understand that the lack of back compatibility is a contagious disease of modern front-end, take a pill already!

Cry from the heart! Without the hope of understanding...

@zurie
Copy link

zurie commented Dec 25, 2016

Also started getting this last night.

Steps to reproduce. ng new / ng serve. delete the node_modules folder, do a npm install. on reinstall I get

`| => ng serve
** NG Live Development Server is running on http://localhost:4200. **
Hash: ba2a078897c00b1e1c4e
Time: 8050ms
chunk {0} main.bundle.js, main.bundle.map (main) 4.65 kB {2} [initial] [rendered]
chunk {1} styles.bundle.js, styles.bundle.map (styles) 10.1 kB {3} [initial] [rendered]
chunk {2} vendor.bundle.js, vendor.bundle.map (vendor) 2.22 MB [initial] [rendered]
chunk {3} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in Cannot read property 'listLazyRoutes' of undefined`

@monoflash
Copy link
Author

Yes Yes! it is the most.
In my project all the routing is built on LazyRoutes and even if I get rid of all the errors, routing does not work. From the word "absolutely". I am sad now...
We can not bear this more! A million dependencies, everything is constantly breaks down and is considered to be the normal. :(

@PG2000
Copy link

PG2000 commented Dec 27, 2016

@monoflash Do you have some example code - maybe a a git repository ?

@monoflash
Copy link
Author

I can not show all the code.
If you do any lazy routing option then it will not work.

src/app/app-routing.module.ts:

// Angular
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

// App services
import { AuthGuard } from './services';

const routes: Routes = [
  { path: '', redirectTo: 'my', pathMatch: 'full' },
  { path: 'my', loadChildren: 'app/my/my.module#MyModule' },
  { path: 'signup', loadChildren: 'app/signup/signup.module#SignupModule' },
  { path: 'signin', loadChildren: 'app/signin/signin.module#SigninModule' },
  { path: 'signout', loadChildren: 'app/signout/signout.module#SignoutModule' },
  { path: 'signforgot', loadChildren: 'app/signforgot/signforgot.module#SignforgotModule' },
  { path: 'admin', loadChildren: 'app/admin/admin.module#AdminModule' },
  { path: '**', redirectTo: 'my' }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
})
export class AppRoutingModule { }

@PG2000
Copy link

PG2000 commented Dec 27, 2016

@monoflash Try to replace all app/ with ./ there was a change i couldn't find anymore...

@monoflash
Copy link
Author

Today project works on [email protected] it's a working code and yes, i try to use version > 19-3 and replace 'app/' to './'
I eliminated all errors, the project is run, it does not show any errors and routing does not work in silence.
So I have to stay on [email protected] version...
Otherwise, the project will no longer work.

@PG2000
Copy link

PG2000 commented Dec 27, 2016

@monoflash Maybe you can show me the routes for example from SignupModule?
Did you upgrade the package.json ?

@monoflash
Copy link
Author

SignupModule in this link (tell me when you look):
https://drive.google.com/open?id=0By3e35OLztgyREN0bzdUeGhwN3M

Yes, after update angular-cli i upgrade package.json
I tried it a few hours all variants

@PG2000
Copy link

PG2000 commented Dec 27, 2016

hmm, can't see the problem. Sorry
I had a similar issue and it worked with replacing the app part of the path with ./
I also had some other issues from 3rd Party Libs which i just saw when i started the server with the --aot flag.

Maybe you can build a small example plunker or repository so that we can check the problem.

@monoflash
Copy link
Author

Ok, I'll make an example, but a little later.

@filipesilva
Copy link
Contributor

If you can get me a simple repro showing the problem I can try and look at it.

@filipesilva filipesilva added the needs: repro steps We cannot reproduce the issue with the information given label Dec 30, 2016
@monoflash
Copy link
Author

monoflash commented Jan 2, 2017

I create test project. It works on [email protected]
https://github.com/monoflash/issue3733

To my great disappointment, I could not check this test project on v1.0.0-beta.24, after update angular to v1.0.0-beta.24 i "caught" the problem described here: #3803

@PG2000
Copy link

PG2000 commented Jan 2, 2017

@monoflash

I did a fresh checkout from your example.

Both branches works as expected ...

I work on Ubuntu 16.04
with

  • npm 4.0.3
  • node 4.7.0

I deleted the node_modules folder and checked
out all dependencies after switching the branch.

Did you reload all deps after upgrading?

Do you have some more details from your environment ?
npm and node Version

First i thought it wasn't working because in
m2.component.html the links are starting with: Module One

@monoflash
Copy link
Author

Yes I reload all deps after upgrading.

$ npm version
{ npm: '4.0.5',
ares: '1.10.1-DEV',
cldr: '30.0.2',
http_parser: '2.7.0',
icu: '58.1',
modules: '51',
node: '7.3.0',
openssl: '1.0.2j',
tz: '2016g',
unicode: '9.0',
uv: '1.10.1',
v8: '5.4.500.45',
zlib: '1.2.8' }

@rodneyjoyce
Copy link

FYI: I upgraded this project to Angular CLI 25.5 and chunking IS working with AOT and lazy loaded routes - https://github.com/rodneyjoyce/lazy-routes

@Meligy
Copy link
Contributor

Meligy commented Jan 21, 2017

Lazy loaded routes are working even in AoT in beta.26.

Non lazy loaded routes pointing to other modules are still not working in AoT. There are a couple promising Pull Requests for that but anyway, that's a separate issue. This one can be closed.

@filipesilva
Copy link
Contributor

Closing as lazy routes are working, and we do test it. There are some bugs that make it not work, mainly #2496, but that is being tracked in that issue.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: repro steps We cannot reproduce the issue with the information given
Projects
None yet
Development

No branches or pull requests

6 participants