Skip to content

Commit

Permalink
fix(@schematics/angular): infer main server file name from main option
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 authored and kyliau committed Sep 10, 2019
1 parent bf8d43f commit 40f9494
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"module": "commonjs"
},
"files": [
"src/main.server.ts"
"src/<%= stripTsExtension(main) %>.ts"
],
"angularCompilerOptions": {
"entryModule": "./<%= rootInSrc ? '' : 'src/' %><%= appDir %>/<%= stripTsExtension(rootModuleFileName) %>#<%= rootModuleClassName %>"
Expand Down
3 changes: 2 additions & 1 deletion packages/schematics/angular/universal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ function updateConfigFile(options: UniversalOptions, tsConfigDirectory: Path): R
fileReplacements = buildTarget.configurations.production.fileReplacements;
}

const mainPath = options.main as string;
clientProject.targets.add({
name: 'server',
builder: Builders.Server,
options: {
outputPath: `dist/${options.clientProject}-server`,
main: join(normalize(clientProject.root), 'src/main.server.ts'),
main: join(normalize(clientProject.root), 'src', mainPath.endsWith('.ts') ? mainPath : mainPath + '.ts'),
tsConfig: join(tsConfigDirectory, `${options.tsconfigFileName}.json`),
},
configurations: {
Expand Down

0 comments on commit 40f9494

Please sign in to comment.