@@ -75,7 +75,6 @@ function modifyWorkspace(options: ApplicationOptions) {
7575 configureBuildConfigurations ( project ) ;
7676 configureTsLint ( project ) ;
7777 addTestOptions ( project ) ;
78- updateServeOptions ( project ) ;
7978 removeProductionConfiguration ( project ) ;
8079 } ) ;
8180}
@@ -86,6 +85,7 @@ function modifyWorkspace(options: ApplicationOptions) {
8685 */
8786function removeProductionConfiguration ( project : ProjectDefinition ) {
8887 const buildTarget = project . targets . get ( 'build' ) ;
88+ const serveTarget = project . targets . get ( 'serve' ) ;
8989 if ( buildTarget === undefined ) {
9090 throw new SchematicsException ( "Build target missing (build)" ) ;
9191 }
@@ -95,7 +95,14 @@ function removeProductionConfiguration(project: ProjectDefinition) {
9595 if ( buildTarget . configurations . production === undefined ) {
9696 throw new SchematicsException ( "Expected build options to be defined" ) ;
9797 }
98+ if ( serveTarget === undefined ) {
99+ throw new SchematicsException ( "Build target missing (serve)" ) ;
100+ }
101+ if ( serveTarget . configurations === undefined ) {
102+ throw new SchematicsException ( "Build target configurations missing (serve)" ) ;
103+ }
98104
105+ delete serveTarget . configurations . production ;
99106 delete buildTarget . configurations . production ;
100107}
101108
@@ -127,18 +134,6 @@ function addBuildOptions(project: ProjectDefinition) {
127134 buildTarget . options [ 'outputPath' ] = 'dist' ;
128135}
129136
130- function updateServeOptions ( project : ProjectDefinition ) {
131- const targets = project . targets ;
132- const serveTarget = targets . get ( 'serve' ) ;
133- if ( serveTarget === undefined ) {
134- throw new SchematicsException ( "Build target missing (serve)" ) ;
135- }
136- if ( serveTarget . configurations === undefined ) {
137- throw new SchematicsException ( "Build target configurations missing (serve)" ) ;
138- }
139- delete serveTarget . configurations . production ;
140- }
141-
142137function addTestOptions ( project : ProjectDefinition ) {
143138 const testTarget = project . targets . get ( 'test' ) ;
144139 if ( testTarget === undefined ) {
0 commit comments