Skip to content

Commit 83143d6

Browse files
committed
Null case
1 parent 7eb3555 commit 83143d6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎lib/NodeStuffPlugin.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ NodeStuffPlugin.prototype.apply = function(compiler) {
8787
return new BasicEvaluatedExpression().setBoolean(false).setRange(expr.range);
8888
});
8989
compiler.parser.plugin("expression module", function() {
90-
return ModuleParserHelpers.addParsedVariable(this, "module", "require(" + JSON.stringify(path.relative(this.state.module.context, path.join(__dirname, "..", "buildin", "module.js"))) + ")(module)");
90+
var moduleJsPath = path.join(__dirname, "..", "buildin", "module.js");
91+
if(this.state.module.context) {
92+
moduleJsPath = path.relative(this.state.module.context, moduleJsPath);
93+
}
94+
return ModuleParserHelpers.addParsedVariable(this, "module", "require(" + JSON.stringify(moduleJsPath) + ")(module)");
9195
});
9296
};

0 commit comments

Comments
 (0)