File tree 1 file changed +13
-14
lines changed
packages/angular_devkit/build_angular/src/app-shell
1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -116,24 +116,23 @@ async function _getServerModuleBundlePath(
116
116
) {
117
117
if ( options . appModuleBundle ) {
118
118
return path . join ( context . workspaceRoot , options . appModuleBundle ) ;
119
- } else {
120
- const { baseOutputPath = '' } = serverResult ;
121
- const outputPath = path . join ( baseOutputPath , browserLocaleDirectory ) ;
119
+ }
122
120
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 ) ;
126
123
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
+ }
130
127
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.' ) ;
136
133
}
134
+
135
+ return path . join ( outputPath , maybeMain ) ;
137
136
}
138
137
139
138
async function _appShellBuilder (
You can’t perform that action at this time.
0 commit comments