Skip to content

Commit a803902

Browse files
committed
fixed webpack#1883
1 parent 5aa5ca6 commit a803902

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

lib/NormalModule.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ NormalModule.prototype.source = function(dependencyTemplates, outputOptions, req
265265
varExpressions.push(v.expression);
266266
});
267267
emitFunction();
268-
var start = block.range ? block.range[0] : 0;
268+
var start = block.range ? block.range[0] : -1;
269269
var end = block.range ? block.range[1] : _source.size();
270270
if(varStartCode) source.insert(start + 0.5, varStartCode);
271271
if(varEndCode) source.insert(end + 0.5, "\n/* WEBPACK VAR INJECTION */" + varEndCode);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function f() {
2+
return module;
3+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
it("should inject variables before exporting", function() {
2+
require("./file").f().should.have.property("webpackPolyfill");
3+
});

0 commit comments

Comments
 (0)