This repository was archived by the owner on Jun 24, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-26
lines changed Expand file tree Collapse file tree 1 file changed +8
-26
lines changed Original file line number Diff line number Diff line change @@ -83,38 +83,20 @@ module.exports = class Middleware extends EventEmitter {
8383 js ( ) {
8484 return ( req , res , next ) => {
8585 res . type ( 'javascript' ) ;
86- const bundler = this . writers . js . bundle ( ) ;
87-
88- bundler . on ( 'error' , cleanup ) ;
89-
90- const writeStream = bundler . pipe ( res ) . on ( 'error' , cleanup ) ;
91-
92- function cleanup ( e ) {
93- res . write ( `console.error(${ JSON . stringify ( e . stack ) } )` ) ;
94- bundler . pause ( ) ;
95- bundler . unpipe ( writeStream ) ;
96- writeStream . end ( ) ;
97- next ( e ) ;
98- }
86+ this . writers . js
87+ . bundle ( )
88+ . on ( 'error' , next )
89+ . pipe ( res ) ;
9990 } ;
10091 }
10192
10293 css ( ) {
10394 return ( req , res , next ) => {
10495 res . type ( 'css' ) ;
105- const bundler = this . writers . css . bundle ( ) ;
106-
107- bundler . on ( 'error' , cleanup ) ;
108-
109- const writeStream = bundler . pipe ( res ) . on ( 'error' , cleanup ) ;
110-
111- function cleanup ( e ) {
112- res . write ( `console.error(${ JSON . stringify ( e . stack ) } )` ) ;
113- bundler . pause ( ) ;
114- bundler . unpipe ( writeStream ) ;
115- writeStream . end ( ) ;
116- next ( e ) ;
117- }
96+ this . writers . css
97+ . bundle ( )
98+ . on ( 'error' , next )
99+ . pipe ( res ) ;
118100 } ;
119101 }
120102} ;
You can’t perform that action at this time.
0 commit comments