@@ -122,6 +122,8 @@ function Server(compiler, options) {
122122 res . end ( "</body></html>" ) ;
123123 } . bind ( this ) ) ;
124124
125+ var contentBase = options . contentBase || process . cwd ( ) ;
126+
125127 var features = {
126128 compress : function ( ) {
127129 if ( options . compress ) {
@@ -235,13 +237,14 @@ function Server(compiler, options) {
235237 historyApiFallback : function ( ) {
236238 if ( options . historyApiFallback ) {
237239 // 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+ ) ;
239244 }
240245 } ,
241246
242247 contentBase : function ( ) {
243- var contentBase = options . contentBase || process . cwd ( ) ;
244-
245248 if ( Array . isArray ( contentBase ) ) {
246249 contentBase . forEach ( function ( item ) {
247250 app . get ( "*" , express . static ( item ) ) ;
@@ -293,11 +296,11 @@ function Server(compiler, options) {
293296 var defaultFeatures = [ "setup" , "headers" , "middleware" ] ;
294297 if ( options . proxy )
295298 defaultFeatures . push ( "proxy" , "middleware" ) ;
296- if ( options . historyApiFallback )
297- defaultFeatures . push ( "historyApiFallback" , "middleware" ) ;
298299 defaultFeatures . push ( "magicHtml" ) ;
299300 if ( options . contentBase !== false )
300301 defaultFeatures . push ( "contentBase" ) ;
302+ if ( options . historyApiFallback )
303+ defaultFeatures . push ( "historyApiFallback" , "middleware" ) ;
301304 // compress is placed last and uses unshift so that it will be the first middleware used
302305 if ( options . compress )
303306 defaultFeatures . unshift ( "compress" ) ;
0 commit comments