@@ -122,6 +122,8 @@ function Server(compiler, options) {
122
122
res . end ( "</body></html>" ) ;
123
123
} . bind ( this ) ) ;
124
124
125
+ var contentBase = options . contentBase || process . cwd ( ) ;
126
+
125
127
var features = {
126
128
compress : function ( ) {
127
129
if ( options . compress ) {
@@ -235,13 +237,14 @@ function Server(compiler, options) {
235
237
historyApiFallback : function ( ) {
236
238
if ( options . historyApiFallback ) {
237
239
// Fall back to /index.html if nothing else matches.
238
- app . use ( historyApiFallback ( typeof options . historyApiFallback === "object" ? options . historyApiFallback : null ) ) ;
240
+ app . use (
241
+ historyApiFallback ( typeof options . historyApiFallback === "object" ? options . historyApiFallback : null ) ,
242
+ express . static ( contentBase )
243
+ ) ;
239
244
}
240
245
} ,
241
246
242
247
contentBase : function ( ) {
243
- var contentBase = options . contentBase || process . cwd ( ) ;
244
-
245
248
if ( Array . isArray ( contentBase ) ) {
246
249
contentBase . forEach ( function ( item ) {
247
250
app . get ( "*" , express . static ( item ) ) ;
@@ -293,11 +296,11 @@ function Server(compiler, options) {
293
296
var defaultFeatures = [ "setup" , "headers" , "middleware" ] ;
294
297
if ( options . proxy )
295
298
defaultFeatures . push ( "proxy" , "middleware" ) ;
296
- if ( options . historyApiFallback )
297
- defaultFeatures . push ( "historyApiFallback" , "middleware" ) ;
298
299
defaultFeatures . push ( "magicHtml" ) ;
299
300
if ( options . contentBase !== false )
300
301
defaultFeatures . push ( "contentBase" ) ;
302
+ if ( options . historyApiFallback )
303
+ defaultFeatures . push ( "historyApiFallback" , "middleware" ) ;
301
304
// compress is placed last and uses unshift so that it will be the first middleware used
302
305
if ( options . compress )
303
306
defaultFeatures . unshift ( "compress" ) ;
0 commit comments