fix windows cross driver path not found issue

This commit is contained in:
曹柯 2015-11-21 01:07:43 +08:00
parent bb2c3558c0
commit 4fe6145f8c
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)");
});