Skip to content

Commit d2b1bca

Browse files
committed
Remove compatibly mode for node.Buffer
webpack#729
1 parent 4a8bf92 commit d2b1bca

7 files changed

Lines changed: 4 additions & 34 deletions

File tree

‎lib/WebpackOptionsDefaulter.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ function WebpackOptionsDefaulter() {
4242
this.set("node.console", false);
4343
this.set("node.process", true);
4444
this.set("node.global", true);
45-
// TODO: add this in next major version
46-
// this.set("node.Buffer", true);
45+
this.set("node.Buffer", true);
4746
this.set("node.setImmediate", true);
4847
this.set("node.__filename", "mock");
4948
this.set("node.__dirname", "mock");

‎lib/node/NodeSourcePlugin.js‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ NodeSourcePlugin.prototype.apply = function(compiler) {
4343
});
4444
}
4545
var bufferType = this.options.Buffer
46-
if(typeof bufferType === "undefined") {
47-
bufferType = this.options.buffer;
48-
if(typeof bufferType === "undefined")
49-
bufferType = true;
50-
}
5146
if(bufferType) {
5247
compiler.parser.plugin("expression Buffer", function(expr) {
5348
return ModuleParserHelpers.addParsedVariable(this, "Buffer", "require(" + JSON.stringify(getPathToModule("buffer", bufferType)) + ").Buffer");

‎test/configCases/target/buffer-backward/index.js‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎test/configCases/target/buffer-backward/warnings.js‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎test/configCases/target/buffer-backward/webpack.config.js‎

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
require("should");
22

33
it("should provide a global Buffer shim", function () {
4-
Buffer.should.be.a.Function;
4+
Buffer.should.be.an.Function;
55
});
66

77
it("should provide the buffer module", function () {
8-
require("buffer").should.be.an.Object;
8+
var buffer = require("buffer");
9+
(typeof buffer).should.be.eql("object");
910
});

test/configCases/target/buffer-backward2/webpack.config.js renamed to test/configCases/target/buffer-default/webpack.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
module.exports = {
22
target: "web",
3-
node: {
4-
buffer: true
5-
}
63
};

0 commit comments

Comments
 (0)