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 {
83
83
js ( ) {
84
84
return ( req , res , next ) => {
85
85
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 ) ;
99
90
} ;
100
91
}
101
92
102
93
css ( ) {
103
94
return ( req , res , next ) => {
104
95
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 ) ;
118
100
} ;
119
101
}
120
102
} ;
You can’t perform that action at this time.
0 commit comments