File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed
packages/angular_devkit/build_angular/src/app-shell Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -116,24 +116,23 @@ async function _getServerModuleBundlePath(
116116) {
117117 if ( options . appModuleBundle ) {
118118 return path . join ( context . workspaceRoot , options . appModuleBundle ) ;
119- } else {
120- const { baseOutputPath = '' } = serverResult ;
121- const outputPath = path . join ( baseOutputPath , browserLocaleDirectory ) ;
119+ }
122120
123- if ( ! fs . existsSync ( outputPath ) ) {
124- throw new Error ( `Could not find server output directory: ${ outputPath } .` ) ;
125- }
121+ const { baseOutputPath = '' } = serverResult ;
122+ const outputPath = path . join ( baseOutputPath , browserLocaleDirectory ) ;
126123
127- const files = fs . readdirSync ( outputPath , 'utf8' ) ;
128- const re = / ^ m a i n \. (?: [ a - z A - Z 0 - 9 ] { 20 } \. ) ? (?: b u n d l e \. ) ? j s $ / ;
129- const maybeMain = files . filter ( x => re . test ( x ) ) [ 0 ] ;
124+ if ( ! fs . existsSync ( outputPath ) ) {
125+ throw new Error ( `Could not find server output directory: ${ outputPath } .` ) ;
126+ }
130127
131- if ( ! maybeMain ) {
132- throw new Error ( 'Could not find the main bundle.' ) ;
133- } else {
134- return path . join ( outputPath , maybeMain ) ;
135- }
128+ const re = / ^ m a i n \. (?: [ a - z A - Z 0 - 9 ] { 20 } \. ) ? j s $ / ;
129+ const maybeMain = fs . readdirSync ( outputPath ) . find ( x => re . test ( x ) ) ;
130+
131+ if ( ! maybeMain ) {
132+ throw new Error ( 'Could not find the main bundle.' ) ;
136133 }
134+
135+ return path . join ( outputPath , maybeMain ) ;
137136}
138137
139138async function _appShellBuilder (
You can’t perform that action at this time.
0 commit comments