Skip to content

Commit

Permalink
fixes webpack#1600
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Nov 14, 2015
1 parent ff16bf4 commit ede0166
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/dependencies/HarmonyExportExpressionDependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ HarmonyExportExpressionDependency.Template.prototype.apply = function(dep, sourc
content = "/* harmony default export */ exports[" + JSON.stringify("default") + "] = ";
else
content = "/* unused harmony default export */ var _unused_webpack_default_export = ";
source.replace(dep.rangeStatement[0], dep.range ? dep.range[0] - 1 : dep.rangeStatement[1] - 1, content);
if(dep.range) {
source.replace(dep.rangeStatement[0], dep.range[0] - 1, content);
source.replace(dep.range[1], dep.rangeStatement[1] - 1, "");
} else {
source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content);
}
};
4 changes: 4 additions & 0 deletions test/cases/parsing/issue-1600/file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// module.js
export default(function () {
return 1;
});
5 changes: 5 additions & 0 deletions test/cases/parsing/issue-1600/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import fn from './file';

it("should compile correctly", function() {
fn().should.be.eql(1);
});

0 comments on commit ede0166

Please sign in to comment.