Skip to content
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

Lazy loaded component is not bootstrapping #158

Open
vytautas-pranskunas- opened this issue Feb 13, 2019 · 4 comments
Open

Lazy loaded component is not bootstrapping #158

vytautas-pranskunas- opened this issue Feb 13, 2019 · 4 comments

Comments

@vytautas-pranskunas-
Copy link

vytautas-pranskunas- commented Feb 13, 2019

I am trying to do routes localization however home component is not bootstrapping on hard refresh also if i any route and do hard refresh get an error - No matches found. But if i click on any link in app.component that uses translated urls they are working. I have clones DEMO project and made home also lazy loaded and it works fine. Can someone help to understand why this might happen?

I have posted this question on Stackoverflow but there is no localize-router tag so I am re-posting it here
https://stackoverflow.com/questions/54672738/localize-router-not-bootstrapping-component-on-refresh

@vytautas-pranskunas-
Copy link
Author

vytautas-pranskunas- commented Feb 14, 2019

I was able to solve this issue and seems like this is not working with initialNavigation: 'enabled' on Router. And this is needed to prevent flickering with SSR.

Also i have an error on SSR: Error: Cannot find module './components/home/home.module.ngfactory' - how this can be solved?

@rafa-suagu
Copy link

@vytautas-pranskunas- I solved this issue.

Our error was on the imports order on app-routing.module. The Router must be the first import, before LocalizeRouter

@NgModule({
  imports: [
    RouterModule.forRoot(appRoutes), <---------------- FIRST
    LocalizeRouterModule.forRoot(appRoutes)
  ],
  exports: [
    RouterModule, <---------------- FIRST
    LocalizeRouterModule
  ]
})

I don't know exactly if it's relevant on the forChild imports and exports but make sense follow the same order.

NOTE: We have SSR implemented

@qubiack
Copy link

qubiack commented Apr 3, 2019

@rafa-as We have import and export for parent app-routing.module, but it's doesn't change anything. Doesn't work.

@gilsdav
Copy link

gilsdav commented Jun 10, 2019

@vytautas-pranskunas- It's an SSR error. Do you use @nguniversal/module-map-ngfactory-loader ?
This module change "lazy-load" to "simple load" only on server-side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants