File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 2
2
MIT License http://www.opensource.org/licenses/mit-license.php
3
3
Author Tobias Koppers @sokra
4
4
*/
5
+ var path = require ( "path" ) ;
5
6
var MemoryFileSystem = require ( "memory-fs" ) ;
6
7
var mime = require ( "mime" ) ;
7
8
@@ -124,15 +125,23 @@ module.exports = function(compiler, options) {
124
125
function webpackDevMiddleware ( req , res , next ) {
125
126
var filename = getFilenameFromUrl ( req . url ) ;
126
127
if ( filename === false ) return next ( ) ;
127
-
128
+
128
129
// in lazy mode, rebuild on bundle request
129
130
if ( options . lazy && filename === pathJoin ( compiler . outputPath , options . filename ) )
130
131
rebuild ( ) ;
131
132
// delay the request until we have a vaild bundle
132
133
ready ( function ( ) {
133
134
try {
134
135
var stat = fs . statSync ( filename ) ;
135
- if ( ! stat . isFile ( ) ) throw "next" ;
136
+ if ( ! stat . isFile ( ) ) {
137
+ if ( stat . isDirectory ( ) ) {
138
+ filename = path . join ( filename , "index.html" ) ;
139
+ stat = fs . statSync ( filename ) ;
140
+ if ( ! stat . isFile ( ) ) throw "next" ;
141
+ } else {
142
+ throw "next" ;
143
+ }
144
+ }
136
145
} catch ( e ) {
137
146
return next ( ) ;
138
147
}
You can’t perform that action at this time.
0 commit comments