-
Notifications
You must be signed in to change notification settings - Fork 26.1k
Compiler generates ngfactory for file with no angular metadata #22193
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
Comments
@chuckjaz looked at this problem yesterday and had this to say:
He also suggested a workaround: type the problematic namespace import as any:
The next major version of Angular CLI will do away with CommonJS for |
Are you going to include chuckjaz's workaround in a release? Would be cool if we don't have to wait the webpack 4 integration and @angular/cli v6 for the real solution. |
@kondi the workaround is in usercode, not in tooling. |
Sorry, I haven't checked the repro repo and I have completely different
imports which cause this. Now I understand.
Thanks for the all the infos and investigation!
… |
@filipesilva @chuckjaz the workaround does not seem to be to type as |
@chuckjaz What's the workaround ? This error happens to me 1/2 times on hot reloads, making my life miserable ! |
Is there any workaround available? |
@Dongata @Starscream27 read the comments : #22193 (comment) |
For me the problem was solved just putting PS: TypeScript and Webpack have conflict when import an image. |
In my case, injecting import { REQUEST } from '@nguniversal/express-engine/tokens';
import { Request } from 'express';
// ...
export class AppComponent {
constructor(@Optional() @Inject(REQUEST) req: Request) {
// ...
}
} Changing the type of export class AppComponent {
constructor(@Optional() @Inject(REQUEST) req: any) {
// ...
}
} |
how is this issue? |
This definitely was/is an issue, which is less of a problem now that |
Closing as resolved in Ivy. |
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...
Current behavior
Under some circumstances, the AOT compiler can generate a
.ngfactory.ts
file for a file with no Angular metadata:"module": "commonjs"
in tsconfig (the CLI sets it automatically forng serve
, for performance reasons)import * as numeral from 'numeral';
) in a file without angular decoratorsWhen all these conditions are met, rebuilds will fail with the following stack trace:
Expected behavior
Compilation succeed.
Minimal reproduction of the problem with instructions
This issue was originally reported and reproduced in angular/angular-cli#9036:
Environment
/cc @chuckjaz
The text was updated successfully, but these errors were encountered: