question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LoadChildren - lazy loaded routes and relative path problems

See original GitHub issue

Bug Report or Feature Request (mark with an x)

  • bug report

Command (mark with an x)

  • build
  • [x ] serve

Versions

NPM 6.2.0 Node v10.9.0 Angular CLI: 6.0.8 Node: 10.9.0 OS: win32 x64 Angular: 6.1.4 Package Version

@angular-devkit/architect 0.6.8 @angular-devkit/build-angular 0.6.8 @angular-devkit/build-optimizer 0.6.8 @angular-devkit/core 0.6.8 @angular-devkit/schematics 0.6.8 @angular/cli 6.0.8 @ngtools/webpack 6.0.8 @schematics/angular 0.6.8 @schematics/update 0.6.8 rxjs 6.2.2 typescript 2.7.2 webpack 4.8.3

Repro steps

  1. To simulate this you have to download source code here (because stackblitz cannot even generate working, ready to download solutions…): load-children-issue.zip

  2. NG serve = error: ERROR in Could not resolve module …/…/room/room.module relative to /D/GIT/angular-empty/bara2/src/app/layout/layout.module.ts

if you check layout.module.ts, routing is imported via index.ts files - importing layoutRouting (layout.routing.ts)

BUt it works when you resave anything (when project is rebuilt on watch. )

Check this picture please: image

Expected behavior

There should be no problem with index.ts files regarding the relative path in loadChildren.

Desired functionality

LoadChildren relative path shoudl work regardless the folder “deepness”

Mention any other details that might be useful

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Oct 1, 2018

@montella1507 It works in the browser

1reaction
filipesilvacommented, Sep 11, 2018

That /D/GIT/angular-empty/...... path makes me think we have a bad path conversion somewhere.

We should also be consistent in these build errors: it should happen on both builds and rebuilds and not just one of these.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular loadChildren property absolute path to module is not ...
I am trying to lazy load a module from ...
Read more >
Lazy-loading feature modules - Angular
To lazy load Angular modules, use loadChildren (instead of component ) in your AppRoutingModule ... The import path is the relative path to...
Read more >
How To Use Lazy Loading Routes in Angular | DigitalOcean
Learn how to enable feature modules to be lazy-loaded in Angular, allowing to load the code for some routes to be loaded on-demand....
Read more >
Lazy Loading Angular Modules - Michele Stieven - Medium
Here, we're using an empty path because these will be the relative routes for this module, not for the entire application . Also,...
Read more >
How to Routing and Lazy loading in Angular - Referbruv
Observe that we're also passing a variable routes which is of type Routes, to the RoutingModule. This routes array contains the paths and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found