Skip to content

Commit 6bdd810

Browse files
committed
fixes webpack#202
1 parent 06056a4 commit 6bdd810

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎lib/dependencies/AMDDefineDependencyParserPlugin.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ AMDDefineDependencyParserPlugin.prototype.apply = function(parser) {
145145
if(param.isArray()) {
146146
param.items.forEach(function(param, idx) {
147147
if(param.isString() && ["require", "module", "exports"].indexOf(param.string) >= 0)
148-
identifiers[idx] = param.string === "require" ? "__webpack_require__" : param.string;
148+
identifiers[idx] = param.string;
149149
var result = this.applyPluginsBailResult("call define:amd:item", expr, param);
150150
if(result === undefined) {
151151
this.applyPluginsBailResult("call define:amd:context", expr, param);

‎test/cases/parsing/extract-amd/index.js‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ it("should parse fancy AMD calls", function() {
2121
(typeof require).should.be.eql("function");
2222
(typeof module).should.be.eql("object");
2323
(typeof exports).should.be.eql("object");
24+
(typeof require("./constructor")).should.be.eql("function");
2425
(typeof constructor).should.be.eql("function");
2526
a.should.be.eql("a");
2627
});
2728
define("-> module module exports *constructor *a".replace("module", "require").substr(3).replace(/\*/g, "./").split(" "), function(require, module, exports, constructor, a) {
2829
(typeof require).should.be.eql("function");
2930
(typeof module).should.be.eql("object");
3031
(typeof exports).should.be.eql("object");
32+
(typeof require("./constructor")).should.be.eql("function");
3133
(typeof constructor).should.be.eql("function");
3234
a.should.be.eql("a");
3335
});
@@ -50,6 +52,13 @@ it("should be able to use require.js-style define", function(done) {
5052
});
5153
});
5254

55+
it("should be able to use require.js-style define, special string", function(done) {
56+
define(["require"], function(require) {
57+
require("./circular").should.be.eql(1);
58+
done();
59+
});
60+
});
61+
5362
it("should be able to use require.js-style define, without name", function(done) {
5463
true && define(["./circular"], function(circular) {
5564
circular.should.be.eql(1);

0 commit comments

Comments
 (0)