Skip to content

Bug: incorrect load children for lazy module when use typings #14690

@splincode

Description

@splincode

🐞 Bug report

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

When I use typing and add module as argument

app-routing.module.ts

 loadChildren: (): Promise<any> =>
       import('./view/auth/auth.module').then((module: any) => module.AuthModule)

Build failed

WARNING in 
Found 'loadChildren' with a non-string syntax in src/app/app-routing.module.ts but could not transform it.
Make sure it matches the format below:

loadChildren: () => import('IMPORT_STRING').then(M => M.EXPORT_NAME)

Please note that only IMPORT_STRING, M, and EXPORT_NAME can be replaced in this format.

Visit https://v8.angular.io/guide/ivy for more information on using Ivy.

but if we change

 loadChildren: () => import('./view/auth/auth.module').then((m) => m.AuthModule)

it's work, but why? This behavior is not obvious enough, I want to specify types forcibly everywhere, but as a result, the parsing does not work correctly! Problem reproduced with only AOT.

🌍 Your Environment


Angular 8.0.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions