File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -107,17 +107,19 @@ module.exports = function(compiler, options) {
107
107
function getFilenameFromUrl ( url ) {
108
108
// publicPrefix is the folder our bundle should be in
109
109
var localPrefix = options . publicPath || "/" ;
110
- if ( / ^ h t t p s ? : \/ \/ / . test ( localPrefix ) ) {
111
- localPrefix = "/" + localPrefix . replace ( / ^ h t t p s ? : \/ \/ [ ^ \/ ] + \/ / , "" ) ;
110
+ if ( url . indexOf ( localPrefix ) !== 0 ) {
111
+ if ( / ^ h t t p s ? : \/ \/ / . test ( localPrefix ) ) {
112
+ localPrefix = "/" + localPrefix . replace ( / ^ h t t p s ? : \/ \/ [ ^ \/ ] + \/ / , "" ) ;
113
+ // fast exit if another directory requested
114
+ if ( url . indexOf ( localPrefix ) !== 0 ) return false ;
115
+ } else return false ;
112
116
}
113
- // fast exit if another directory requested
114
- if ( url . indexOf ( localPrefix ) !== 0 ) return false ;
115
117
// get filename from request
116
118
var filename = url . substr ( localPrefix . length ) ;
117
119
if ( filename . indexOf ( "?" ) >= 0 ) {
118
120
filename = filename . substr ( 0 , filename . indexOf ( "?" ) ) ;
119
121
}
120
- return pathJoin ( compiler . outputPath , filename ) ;
122
+ return filename ? pathJoin ( compiler . outputPath , filename ) : compiler . outputPath ;
121
123
}
122
124
123
125
// The middleware function
You can’t perform that action at this time.
0 commit comments