Exclude spec files from AoT#2758
Conversation
packages/webpack/src/plugin.ts
Outdated
| 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.
to be 100% sure: .filter(fileName => fileName.match(/.spec.ts$/) === null); ? :)
There was a problem hiding this comment.
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