mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 10:33:43 +08:00
fix(@angular/cli): support existing tsconfig.spec.json on Angular 5
This commit is contained in:
parent
08b284ec62
commit
d55740d4fa
@ -86,7 +86,8 @@ function _createAotPlugin(wco: WebpackConfigOptions, options: any) {
|
|||||||
hostReplacementPaths,
|
hostReplacementPaths,
|
||||||
sourceMap: buildOptions.sourcemaps,
|
sourceMap: buildOptions.sourcemaps,
|
||||||
// If we don't explicitely list excludes, it will default to `['**/*.spec.ts']`.
|
// If we don't explicitely list excludes, it will default to `['**/*.spec.ts']`.
|
||||||
exclude: []
|
exclude: [],
|
||||||
|
include: options.include,
|
||||||
}, options);
|
}, options);
|
||||||
return new AngularCompilerPlugin(pluginOptions);
|
return new AngularCompilerPlugin(pluginOptions);
|
||||||
} else {
|
} else {
|
||||||
@ -149,7 +150,12 @@ export function getNonAotTestConfig(wco: WebpackConfigOptions) {
|
|||||||
const tsConfigPath = path.resolve(projectRoot, appConfig.root, appConfig.testTsconfig);
|
const tsConfigPath = path.resolve(projectRoot, appConfig.root, appConfig.testTsconfig);
|
||||||
const appTsConfigPath = path.resolve(projectRoot, appConfig.root, appConfig.tsconfig);
|
const appTsConfigPath = path.resolve(projectRoot, appConfig.root, appConfig.tsconfig);
|
||||||
|
|
||||||
let pluginOptions: any = { tsConfigPath, skipCodeGeneration: true };
|
// Force include main and polyfills.
|
||||||
|
// This is needed for AngularCompilerPlugin compatibility with existing projects,
|
||||||
|
// since TS compilation there is stricter and tsconfig.spec.ts doesn't include them.
|
||||||
|
const include = [appConfig.main, appConfig.polyfills];
|
||||||
|
|
||||||
|
let pluginOptions: any = { tsConfigPath, skipCodeGeneration: true, include };
|
||||||
|
|
||||||
// Fallback to correct module format on projects using a shared tsconfig.
|
// Fallback to correct module format on projects using a shared tsconfig.
|
||||||
if (tsConfigPath === appTsConfigPath) {
|
if (tsConfigPath === appTsConfigPath) {
|
||||||
|
@ -193,6 +193,12 @@ export class AngularCompilerPlugin implements Tapable {
|
|||||||
tsConfigJson.exclude = tsConfigJson.exclude.concat(options.exclude);
|
tsConfigJson.exclude = tsConfigJson.exclude.concat(options.exclude);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add extra includes.
|
||||||
|
if (options.hasOwnProperty('include') && Array.isArray(options.include)) {
|
||||||
|
tsConfigJson.include = tsConfigJson.include || [];
|
||||||
|
tsConfigJson.include.push(...options.include);
|
||||||
|
}
|
||||||
|
|
||||||
// Parse the tsconfig contents.
|
// Parse the tsconfig contents.
|
||||||
const tsConfig = ts.parseJsonConfigFileContent(
|
const tsConfig = ts.parseJsonConfigFileContent(
|
||||||
tsConfigJson, ts.sys, basePath, undefined, this._tsConfigPath);
|
tsConfigJson, ts.sys, basePath, undefined, this._tsConfigPath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user