Merge pull request #1654 from gbk/webpack-1

Fix windows cross driver path not found issue
This commit is contained in:
Tobias Koppers 2015-11-20 22:21:44 +01:00
commit cfd8d42cec
1 changed files with 4 additions and 1 deletions

View File

@ -89,7 +89,10 @@ NodeStuffPlugin.prototype.apply = function(compiler) {
compiler.parser.plugin("expression module", function() {
var moduleJsPath = path.join(__dirname, "..", "buildin", "module.js");
if(this.state.module.context) {
moduleJsPath = "./" + path.relative(this.state.module.context, moduleJsPath).replace(/\\/g, "/");
moduleJsPath = path.relative(this.state.module.context, moduleJsPath);
if(!/^[A-Z]:/i.test(moduleJsPath)) {
moduleJsPath = "./" + moduleJsPath.replace(/\\/g, "/");
}
}
return ModuleParserHelpers.addParsedVariable(this, "module", "require(" + JSON.stringify(moduleJsPath) + ")(module)");
});