File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 "private" : true ,
1111 "devDependencies" : {
1212 "rimraf" : " ^3.0.0" ,
13- "webpack" : " ^4.39.3 "
13+ "webpack" : " ^5.95.0 "
1414 }
1515}
Original file line number Diff line number Diff line change @@ -27,27 +27,47 @@ export default class MockBundle {
2727 entry : this . entry ,
2828 output : {
2929 path : this . outputDir ,
30- libraryExport : 'default' ,
30+ filename : 'main.js' ,
31+ library : {
32+ type : 'commonjs2' ,
33+ export : 'default' ,
34+ } ,
3135 } ,
3236 devtool : 'source-map' ,
37+ /**
38+ * Webpack 5 requires explicit target configuration
39+ */
40+ target : 'node' ,
3341 } , ( err , stats ) => {
3442 if ( err ) {
43+ console . error ( '[MockBundle] Webpack compilation error:' , err ) ;
3544 reject ( err ) ;
3645
3746 return ;
3847 }
3948
49+ if ( ! stats ) {
50+ reject ( new Error ( 'Webpack stats is undefined' ) ) ;
51+
52+ return ;
53+ }
54+
4055 const info = stats . toJson ( ) ;
4156
4257 if ( stats . hasErrors ( ) ) {
58+ console . error ( '[MockBundle] Webpack compilation errors:' ) ;
59+ console . error ( JSON . stringify ( info . errors , null , 2 ) ) ;
4360 reject ( info . errors ) ;
61+
62+ return ;
4463 }
4564
4665 if ( stats . hasWarnings ( ) ) {
47- console . warn ( info . warnings ) ;
66+ console . warn ( '[MockBundle] Webpack compilation warnings:' ) ;
67+ console . warn ( JSON . stringify ( info . warnings , null , 2 ) ) ;
4868 }
4969
50- resolve ( info ) ;
70+ resolve ( ) ;
5171 } ) ;
5272 } ) ;
5373 }
You can’t perform that action at this time.
0 commit comments