@@ -59,41 +59,45 @@ export class IndexHtmlWebpackPlugin extends IndexHtmlGenerator {
59
59
const noModuleFiles : FileInfo [ ] = [ ] ;
60
60
const moduleFiles : FileInfo [ ] = [ ] ;
61
61
62
- for ( const [ entryName , entrypoint ] of this . compilation . entrypoints ) {
63
- const entryFiles : FileInfo [ ] = entrypoint ?. getFiles ( ) ?. map (
64
- ( f : string ) : FileInfo => ( {
65
- name : entryName ,
66
- file : f ,
67
- extension : extname ( f ) ,
68
- } ) ,
69
- ) ;
70
-
71
- if ( ! entryFiles ) {
72
- continue ;
62
+ try {
63
+ for ( const [ entryName , entrypoint ] of this . compilation . entrypoints ) {
64
+ const entryFiles : FileInfo [ ] = entrypoint ?. getFiles ( ) ?. map (
65
+ ( f : string ) : FileInfo => ( {
66
+ name : entryName ,
67
+ file : f ,
68
+ extension : extname ( f ) ,
69
+ } ) ,
70
+ ) ;
71
+
72
+ if ( ! entryFiles ) {
73
+ continue ;
74
+ }
75
+
76
+ if ( this . options . noModuleEntrypoints . includes ( entryName ) ) {
77
+ noModuleFiles . push ( ...entryFiles ) ;
78
+ } else if ( this . options . moduleEntrypoints . includes ( entryName ) ) {
79
+ moduleFiles . push ( ...entryFiles ) ;
80
+ } else {
81
+ files . push ( ...entryFiles ) ;
82
+ }
73
83
}
74
84
75
- if ( this . options . noModuleEntrypoints . includes ( entryName ) ) {
76
- noModuleFiles . push ( ...entryFiles ) ;
77
- } else if ( this . options . moduleEntrypoints . includes ( entryName ) ) {
78
- moduleFiles . push ( ...entryFiles ) ;
79
- } else {
80
- files . push ( ...entryFiles ) ;
81
- }
85
+ const { content, warnings, errors } = await this . process ( {
86
+ files,
87
+ noModuleFiles,
88
+ moduleFiles,
89
+ outputPath : dirname ( this . options . outputPath ) ,
90
+ baseHref : this . options . baseHref ,
91
+ lang : this . options . lang ,
92
+ } ) ;
93
+
94
+ assets [ this . options . outputPath ] = new RawSource ( content ) ;
95
+
96
+ warnings . forEach ( msg => addWarning ( this . compilation , msg ) ) ;
97
+ errors . forEach ( msg => addError ( this . compilation , msg ) ) ;
98
+ } catch ( error ) {
99
+ addError ( this . compilation , error . message ) ;
82
100
}
83
-
84
- const { content, warnings, errors } = await this . process ( {
85
- files,
86
- noModuleFiles,
87
- moduleFiles,
88
- outputPath : dirname ( this . options . outputPath ) ,
89
- baseHref : this . options . baseHref ,
90
- lang : this . options . lang ,
91
- } ) ;
92
-
93
- assets [ this . options . outputPath ] = new RawSource ( content ) ;
94
-
95
- warnings . forEach ( msg => addWarning ( this . compilation , msg ) ) ;
96
- errors . forEach ( msg => addError ( this . compilation , msg ) ) ;
97
101
} ;
98
102
}
99
103
0 commit comments