Skip to content

Commit 5189d9a

Browse files
committed
fixed webpack#2019
1 parent f7f4fcc commit 5189d9a

4 files changed

Lines changed: 14 additions & 1 deletion

File tree

lib/dependencies/HarmonyExportExpressionDependency.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ HarmonyExportExpressionDependency.Template.prototype.apply = function(dep, sourc
3434
content = "/* unused harmony default export */ var _unused_webpack_default_export = ";
3535
if(dep.range) {
3636
source.replace(dep.rangeStatement[0], dep.range[0] - 1, content);
37-
source.replace(dep.range[1], dep.rangeStatement[1] - 1, "");
37+
source.replace(dep.range[1], dep.rangeStatement[1] - 1, ";");
3838
} else {
3939
source.replace(dep.rangeStatement[0], dep.rangeStatement[1] - 1, content);
4040
}

test/cases/parsing/harmony/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ import { specA, specB } from "exports-specifier";
1717
import Thing, { Other } from "commonjs";
1818
import Thing2, { Other as Other2 } from "commonjs-trans";
1919

20+
import defaultExport from "def";
21+
22+
23+
it("should import a default export from a module", function() {
24+
defaultExport.should.be.eql("def");
25+
});
2026

2127
it("should import an identifier from a module", function() {
2228
a.should.be.eql("a");
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var CONSTANT = "const";
2+
var def = "default";
3+
export default def; export { CONSTANT };
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
it("should not fail on default export before export", function() {
2+
require("./file").default.should.be.eql("default");
3+
require("./file").CONSTANT.should.be.eql("const");
4+
});

0 commit comments

Comments
 (0)