test case for resolving node buildin libs

webpack/webpack#747
This commit is contained in:
Tobias Koppers 2015-02-03 23:29:00 +01:00
parent 85af275e93
commit 5ca01e92f4
4 changed files with 8 additions and 2 deletions

View File

@ -67,7 +67,7 @@ NodeSourcePlugin.prototype.apply = function(compiler) {
var alias = {};
Object.keys(nodeLibsBrowser).forEach(function(lib) {
if(options[lib] !== false)
alias[lib] = getPathToModule(lib, options[lib]);
alias[lib + "$"] = getPathToModule(lib, options[lib]);
});
if(Object.keys(alias).length > 0) {
compiler.resolvers.normal.apply(

View File

@ -92,4 +92,8 @@ it("should provide a vm shim", function () {
it("should provide a zlib shim", function () {
require("zlib").should.be.an.Object;
});
});
it("should provide a shim for a path in a build-in module", function () {
require("process/in.js").should.be.eql("in process");
});

View File

@ -0,0 +1 @@
module.exports = "in process";

View File

@ -0,0 +1 @@
throw new Error("Should not be loaded");