-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Exclude spec files from AoT #2758
Conversation
@@ -88,7 +88,8 @@ export class AotPlugin { | |||
} | |||
|
|||
const tsConfig = tsc.readConfiguration(options.tsConfigPath, basePath); | |||
this._rootFilePath = tsConfig.parsed.fileNames; | |||
this._rootFilePath = tsConfig.parsed.fileNames | |||
.filter(fileName => fileName.indexOf('.spec.ts') < 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be 100% sure: .filter(fileName => fileName.match(/.spec.ts$/) === null);
? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like/\.spec\.ts$/.test(fileName)
better since it returns boolean directly
Tests were failing but it wasn't related to this PR, and fixed in #2832. While I understand that this fix works, it shouldn't be necessary because of https://github.com/angular/angular-cli/blob/master/packages/angular-cli/models/webpack-build-typescript.ts#L57. Spec files shouldn't even be included. @hansl can you have a look? |
@filipesilva , https://github.com/angular/angular-cli/blob/master/packages/angular-cli/models/webpack-build-typescript.ts#L57 does exclude the file from what module will imports, but not from ngc/tsc, since in fact the spec files still get compiled by ngc (you can log the fileNames there and find out the spec files still get listed and then compiled) |
@filipesilva @hansl , any updates on this? |
LGTM. |
Thank you @hansl @filipesilva |
When can we have that fix available through NPM? |
@ptomaszi It's on npm since beta 20-1 |
@antonybudianto somehow off-topic, but how can one "log the fileNames" that get compiled by ngc? Thanks |
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. |
fix #2736