Skip to content

Commit

Permalink
fix: push exported variable when hoisting export declared names (#12110)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Sep 28, 2020
1 parent a080c82 commit 62df8d2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
8 changes: 5 additions & 3 deletions packages/babel-plugin-transform-modules-systemjs/src/index.js
Expand Up @@ -506,9 +506,11 @@ export default declare((api, options) => {
path,
(id, name, hasInit) => {
variableIds.push(id);
if (!hasInit) {
exportNames.push(name);
exportValues.push(scope.buildUndefinedNode());
if (!hasInit && name in exportMap) {
for (const exported of exportMap[name]) {
exportNames.push(exported);
exportValues.push(scope.buildUndefinedNode());
}
}
},
null,
Expand Down
Expand Up @@ -3,7 +3,7 @@ System.register([], function (_export, _context) {

var foo;

_export("foo", void 0);
_export("bar", void 0);

return {
setters: [],
Expand Down
Expand Up @@ -3,7 +3,7 @@ System.register([], function (_export, _context) {

var foo;

_export("foo", void 0);
_export("default", void 0);

return {
setters: [],
Expand Down
Expand Up @@ -4,7 +4,7 @@ System.register([], function (_export, _context) {
var foo, bar;

_export({
foo: void 0,
default: void 0,
bar: void 0
});

Expand Down
Expand Up @@ -7,10 +7,7 @@ System.register(["./evens"], function (_export, _context) {
return _export("p", p = isEven(n) ? n + 1 : n + 2);
}

_export({
nextOdd: nextOdd,
a: void 0
});
_export("nextOdd", nextOdd);

return {
setters: [function (_evens) {
Expand Down

0 comments on commit 62df8d2

Please sign in to comment.