💻
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
export const a = 1;
export const b = 2;
export const c = 13;
export const d = '41';
export const e = 15;
export const f = 71;
export const g = () => {
return 1;
};
Configuration file name
.babelrc
Configuration
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": "ios 10"
},
},
],
]
}
Current and expected behavior
The output js includes a long assignment continuously to make every exports as void 0 before they got the real value assigned:
exports.g = exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0;
When too many exports, like more than 500 exports in my case, it would leads JSC(JavaScript Core) engine to thorw the error "Maximum call stack size exceeded" while the code running there.
Full js file output:
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.g = exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0;
var a = 1;
exports.a = a;
var b = 2;
exports.b = b;
var c = 13;
exports.c = c;
var d = '41';
exports.d = d;
var e = 15;
exports.e = e;
var f = 71;
exports.f = f;
var g = () => {
return 1;
};
exports.g = g;
Environment
- Babel version: 7.17.0 (@babel/core 7.17.2)
- @babel/preset-env version: 7.16.11
- JavaScript Core Engine version: 7611.3.10.0.1
Possible solution
To limit the maximum initial assignments for every single expression might help, like 100.
It should be splitted as multiple assignment expressions if it over the limit.
Additional context
No response
💻
How are you using Babel?
Programmatic API (
babel.transform,babel.parse)Input code
Configuration file name
.babelrc
Configuration
Current and expected behavior
The output js includes a long assignment continuously to make every exports as
void 0before they got the real value assigned:When too many exports, like more than 500 exports in my case, it would leads JSC(JavaScript Core) engine to thorw the error "Maximum call stack size exceeded" while the code running there.
Full js file output:
Environment
Possible solution
To limit the maximum initial assignments for every single expression might help, like 100.
It should be splitted as multiple assignment expressions if it over the limit.
Additional context
No response