Skip to content

Commit 40517e1

Browse files
committed
fail if the given context is not absolute
1 parent 9e644ac commit 40517e1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎lib/webpack.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55
"use strict";
66

7+
const path = require("path");
8+
79
const Compiler = require("./Compiler");
810
const MultiCompiler = require("./MultiCompiler");
911
const NodeEnvironmentPlugin = require("./node/NodeEnvironmentPlugin");
@@ -24,6 +26,10 @@ function webpack(options, callback) {
2426
} else if(typeof options === "object") {
2527
new WebpackOptionsDefaulter().process(options);
2628

29+
if(options.context && !path.isAbsolute(options.context)) {
30+
throw new Error(`option.context (${options.context}) must be an absolute path`);
31+
}
32+
2733
compiler = new Compiler();
2834
compiler.context = options.context;
2935
compiler.options = options;

0 commit comments

Comments
 (0)