Make buildExportAll generate pure ES5 code.
The untransformed `let` keyword causes problems for older parsers. I understand using `let` instead of `var` ensures each getter function has its own binding for the KEY variable, but the same can be accomplished (with less code) using a `.forEach` callback function, and this way there's no need to worry about generating a unique name for the `key` variable.
This commit is contained in:
@@ -4,17 +4,15 @@ define(["exports", "foo"], function (exports, _foo) {
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
for (let _key in _foo) {
|
||||
if (_key === "default") continue;
|
||||
Object.defineProperty(exports, _key, {
|
||||
Object.keys(_foo).forEach(function (key) {
|
||||
if (key === "default") return;
|
||||
Object.defineProperty(exports, key, {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _foo[_key];
|
||||
return _foo[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
Object.defineProperty(exports, "foo", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
|
||||
Reference in New Issue
Block a user