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
@ngtools/webpack AOT loader failed to resolve nested exports (Barrels) #8581
Comments
This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please? You can read here why this is needed. A good way to make a minimal repro is to create a new app via |
@filipesilva , I've prepared reproduction repo for you. It can be build with jit or aot. Jit build works, but aot throws an error at compile stage, you can play with it, I've left commented lines which will work with aot, but with 1 level deep nesting: |
@filipesilva , I've created another repo which is based on pure angular-cli (ng new) plus applied barrels. In this case not working neither JIT nor AOT. So I assume this is angular cli bug. |
@filipesilva any progress on this ? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Versions
Repro steps
Use barrels system in project based on index.ts, that every feature folder consists of index.ts where you can re-export components, so instead of:
import { AuthService } from '@app/core/services/auth.service';
You can do:
import * as Core from '@app/core';
and use any entity inside Core like this:
Core.Services.AuthService
Reproduction:
Observed behavior
JIT compiles like a charm without any problems, but when I try to compile using AOT with help of
@ngtools/webpack
mentioned behavior not work. AOT plugin cannot see any further than second property, for example when I inject service into constructor like this:constructor(private router: Router, private authService: Core.Services.AuthService)
I get next error:
ERROR in Error: Can't resolve all parameters for AppLaunchComponent in /Client/app/app.launch.ts: ([object Object], ?).
so second parameter does not recognized, but when I import CoreServices directly and use like this:
constructor(private router: Router, private authService: CoreServices.AuthService)
it could recognize all parameters.
But I really like to import one-line just Core and nothing more, because we have 1000+ components in our app, so import each separately is absolutely not an option.
Desired behavior
Do not drop(tree-shake) nested exports while parsing import sequence!
Is it possible to see this bug fixed ?
The text was updated successfully, but these errors were encountered: