Skip to content

Commit e896293

Browse files
committed
Improve compiler outputPath detection
1 parent 13aaf0f commit e896293

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

middleware.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
var MemoryFileSystem = require("memory-fs");
66
var mime = require("mime");
77
var parseRange = require("range-parser");
8+
var path = require("path");
89
var getFilenameFromUrl = require("./lib/GetFilenameFromUrl");
910
var pathJoin = require("./lib/PathJoin");
1011

@@ -55,7 +56,7 @@ module.exports = function(compiler, options) {
5556
if(typeof options.reporter !== "function") options.reporter = defaultReporter;
5657
if(typeof options.log !== "function") options.log = console.log.bind(console);
5758
if(typeof options.warn !== "function") options.warn = console.warn.bind(console);
58-
if(typeof compiler.outputPath === "string" && compiler.outputPath.lastIndexOf("/", 0) !== 0) {
59+
if(typeof compiler.outputPath === "string" && !path.isAbsolute(compiler.outputPath)) {
5960
throw new Error("`output.path` needs to be an absolute path or `/`.");
6061
}
6162

0 commit comments

Comments
 (0)