diff --git a/packages/schematics/angular/universal/files/__tsconfigFileName__.json b/packages/schematics/angular/universal/files/__tsconfigFileName__.json index 552fe89351..c63eef6b08 100644 --- a/packages/schematics/angular/universal/files/__tsconfigFileName__.json +++ b/packages/schematics/angular/universal/files/__tsconfigFileName__.json @@ -1,15 +1,9 @@ { - "extends": "../tsconfig.json", + "extends": "./<%= tsConfigExtends %>", "compilerOptions": { "outDir": "<%= outDir %>-server", - "baseUrl": "./", - "module": "commonjs", - "types": [] + "module": "commonjs" }, - "exclude": [ - "test.ts", - "**/*.spec.ts" - ], "angularCompilerOptions": { "entryModule": "<%= appDir %>/<%= stripTsExtension(rootModuleFileName) %>#<%= rootModuleClassName %>" } diff --git a/packages/schematics/angular/universal/index.ts b/packages/schematics/angular/universal/index.ts index 1f2bd165c9..2129b6ca98 100644 --- a/packages/schematics/angular/universal/index.ts +++ b/packages/schematics/angular/universal/index.ts @@ -5,7 +5,14 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import { JsonObject, experimental, normalize, parseJson, strings } from '@angular-devkit/core'; +import { + JsonObject, + basename, + experimental, + normalize, + parseJson, + strings, +} from '@angular-devkit/core'; import { Rule, SchematicContext, @@ -197,12 +204,14 @@ export default function (options: UniversalOptions): Rule { const clientProject = getClientProject(host, options); const clientArchitect = getClientArchitect(host, options); const outDir = getTsConfigOutDir(host, clientArchitect); + const tsConfigExtends = basename(clientArchitect.build.options.tsConfig); const templateSource = apply(url('./files'), [ template({ ...strings, ...options as object, stripTsExtension: (s: string) => { return s.replace(/\.ts$/, ''); }, outDir, + tsConfigExtends, }), move(clientProject.root), ]); diff --git a/packages/schematics/angular/universal/index_spec.ts b/packages/schematics/angular/universal/index_spec.ts index c783384837..6dc3b92f02 100644 --- a/packages/schematics/angular/universal/index_spec.ts +++ b/packages/schematics/angular/universal/index_spec.ts @@ -62,7 +62,16 @@ describe('Universal Schematic', () => { const filePath = '/projects/bar/tsconfig.server.json'; expect(tree.exists(filePath)).toEqual(true); const contents = tree.readContent(filePath); - expect(contents).toMatch('../../out-tsc/app-server'); + expect(JSON.parse(contents)).toEqual({ + extends: './tsconfig.app.json', + compilerOptions: { + outDir: '../../out-tsc/app-server', + module: 'commonjs', + }, + angularCompilerOptions: { + entryModule: 'src/app/app.server.module#AppServerModule', + }, + }); }); it('should add dependency: @angular/platform-server', () => { diff --git a/packages/schematics/angular/universal/schema.json b/packages/schematics/angular/universal/schema.json index e289ff3670..79027f7ddc 100644 --- a/packages/schematics/angular/universal/schema.json +++ b/packages/schematics/angular/universal/schema.json @@ -40,7 +40,7 @@ "type": "string", "format": "path", "description": "The name of the application directory.", - "default": "app" + "default": "src/app" }, "rootModuleFileName": { "type": "string",