Skip to content

Dynamic Imports broken when pointing at a barrel file #14399

Closed
@FrozenPandaz

Description

@FrozenPandaz

🐞 Bug report

Command (mark with an x)

[x] build --aot
[x] serve --aot

Is this a regression?

Sort of, using a loadChildren string works. But Dynamic imports which are supposed to be a drop in replacement, do not work.

Description

When a loadChildren callback uses a dynamic import to bring in a lazy loaded module from a barrel file, the path gets changed to ./path-to-barrel.ngfactory in AoT. Which does not work.

🔬 Minimal Reproduction

https://github.com/FrozenPandaz/angular-bugs/tree/dyna-imp-bug

🔥 Exception or Error

Module not found: Error: Can't resolve './shared.ngfactory' in '/home/jason/projects/temp/test-proj/src/app'

The src is

loadChildren: import('./shared').then(mod => mod.LazyModule)

🌍 Your Environment

Latest rc

Anything else relevant?
This is important for Nx, which has public apis for its libs.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions