@@ -201,36 +201,34 @@ function Server(compiler, options) {
201
201
} ,
202
202
203
203
contentBase : function ( ) {
204
- if ( options . contentBase !== false ) {
205
- var contentBase = options . contentBase || process . cwd ( ) ;
204
+ var contentBase = options . contentBase || process . cwd ( ) ;
206
205
207
- if ( Array . isArray ( contentBase ) ) {
208
- contentBase . forEach ( function ( item ) {
209
- app . get ( "*" , express . static ( item ) ) ;
210
- } ) ;
211
- contentBase . forEach ( function ( item ) {
212
- app . get ( "*" , serveIndex ( item ) ) ;
213
- } ) ;
214
- } else if ( / ^ ( h t t p s ? : ) ? \/ \/ / . test ( contentBase ) ) {
215
- // Redirect every request to contentBase
216
- app . get ( "*" , function ( req , res ) {
217
- res . writeHead ( 302 , {
218
- 'Location' : contentBase + req . path + ( req . _parsedUrl . search || "" )
219
- } ) ;
220
- res . end ( ) ;
206
+ if ( Array . isArray ( contentBase ) ) {
207
+ contentBase . forEach ( function ( item ) {
208
+ app . get ( "*" , express . static ( item ) ) ;
209
+ } ) ;
210
+ contentBase . forEach ( function ( item ) {
211
+ app . get ( "*" , serveIndex ( item ) ) ;
212
+ } ) ;
213
+ } else if ( / ^ ( h t t p s ? : ) ? \/ \/ / . test ( contentBase ) ) {
214
+ // Redirect every request to contentBase
215
+ app . get ( "*" , function ( req , res ) {
216
+ res . writeHead ( 302 , {
217
+ 'Location' : contentBase + req . path + ( req . _parsedUrl . search || "" )
221
218
} ) ;
222
- } else if ( typeof contentBase === "number" ) {
223
- // Redirect every request to the port contentBase
224
- app . get ( "*" , function ( req , res ) {
225
- res . writeHead ( 302 , {
226
- 'Location' : "//localhost:" + contentBase + req . path + ( req . _parsedUrl . search || "" )
227
- } ) ;
228
- res . end ( ) ;
219
+ res . end ( ) ;
220
+ } ) ;
221
+ } else if ( typeof contentBase === "number" ) {
222
+ // Redirect every request to the port contentBase
223
+ app . get ( "*" , function ( req , res ) {
224
+ res . writeHead ( 302 , {
225
+ 'Location' : "//localhost:" + contentBase + req . path + ( req . _parsedUrl . search || "" )
229
226
} ) ;
230
- } else {
231
- // route content request
232
- app . get ( "*" , express . static ( contentBase , options . staticOptions ) , serveIndex ( contentBase ) ) ;
233
- }
227
+ res . end ( ) ;
228
+ } ) ;
229
+ } else {
230
+ // route content request
231
+ app . get ( "*" , express . static ( contentBase , options . staticOptions ) , serveIndex ( contentBase ) ) ;
234
232
}
235
233
} ,
236
234
0 commit comments