Skip to content

Commit 6d1f3e3

Browse files
committed
fixes webpack#2895
1 parent c51c59c commit 6d1f3e3

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

lib/dependencies/HarmonyExportSpecifierDependency.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ HarmonyExportSpecifierDependency.Template.prototype.apply = function(dep, source
4747
} else {
4848
content = "/* harmony export (binding) */ __webpack_require__.d(exports, " + JSON.stringify(used) + ", function() { return " + dep.id + "; });\n";
4949
}
50+
if(dep.position > 0)
51+
content = "\n" + content;
5052
source.insert(dep.position, content);
5153

5254
};

test/cases/parsing/issue-2895/a.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const a = {
2+
x: 1
3+
}, b = {
4+
x: 2
5+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { a, b } from "./a";
2+
3+
it("should export a const value without semicolon", function() {
4+
a.should.be.eql({x: 1});
5+
b.should.be.eql({x: 2});
6+
});

0 commit comments

Comments
 (0)