Skip to content

Commit b8ca9f5

Browse files
committed
Use platform-agnostic pathJoin over path.join
Using path.join for memory-fs leads to problems on Windows, because the path module will be path.win32 instead of path.unix, which of course uses backslash as the directory separator. We could explicitly import path.posix, but since this same JS file already includes a generic path.join that seems to work in enough cases for us, it seems OK to just use that.
1 parent 75367b8 commit b8ca9f5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

middleware.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
var path = require("path");
65
var MemoryFileSystem = require("memory-fs");
76
var mime = require("mime");
87

@@ -155,7 +154,7 @@ module.exports = function(compiler, options) {
155154
var stat = fs.statSync(filename);
156155
if(!stat.isFile()) {
157156
if (stat.isDirectory()) {
158-
filename = path.join(filename, "index.html");
157+
filename = pathJoin(filename, "index.html");
159158
stat = fs.statSync(filename);
160159
if(!stat.isFile()) throw "next";
161160
} else {

0 commit comments

Comments
 (0)