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

Dynamic Imports broken when pointing at a barrel file #14399

Closed
FrozenPandaz opened this issue May 10, 2019 · 2 comments · Fixed by #14414
Closed

Dynamic Imports broken when pointing at a barrel file #14399

FrozenPandaz opened this issue May 10, 2019 · 2 comments · Fixed by #14414

Comments

@FrozenPandaz
Copy link
Contributor

FrozenPandaz commented May 10, 2019

🐞 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.

@filipesilva filipesilva added area: @ngtools/webpack freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix labels May 10, 2019
@ngbot ngbot bot modified the milestone: Backlog May 10, 2019
@filipesilva filipesilva modified the milestones: Backlog, 8.0 May 10, 2019
@FrozenPandaz
Copy link
Contributor Author

@filipesilva Can we bump this to a freq2: medium?

The migration will have dynamic imports everywhere and lots of users may encounter this after that.

Also, Nx has a fair amount of users which would all encounter this.

@alexeagle alexeagle added freq2: medium and removed freq1: low Only reported by a handful of users who observe it rarely labels May 10, 2019
@filipesilva filipesilva self-assigned this May 13, 2019
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 13, 2019
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 13, 2019
filipesilva added a commit to filipesilva/angular-cli that referenced this issue May 14, 2019
@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 9, 2019
ikjelle pushed a commit to ikjelle/angular-cli that referenced this issue Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.