`Object.getOwnPropertyDescriptor` is not polyfilled in ES5
Florent-Bouisset opened this issue · comments
Describe the bug
Hello, I'm not sure this is a bug or if I misunderstood something in how SWC is polyfiling code.
I'm trying to bundle and polyfill the following code to es5.
// input.js
const object1 = {
property1: 42,
};
const descriptors1 = Object.getOwnPropertyDescriptors(object1);
The polyfill output is:
// output.js
var object1 = {
property1: 42
};
var descriptors1 = Object.getOwnPropertyDescriptors(object1);
I can see const
has been successfully changed to var
, but the method Object.getOwnPropertyDescriptors
has not been polyfilled (it's an es7 feature and is not available in es5).
Thanks for you help
Input code
No response
Config
{
"jsc": {
"parser": {
"syntax": "ecmascript",
"jsx": false,
},
"target": "es5",
"loose": true,
"minify": {
"compress": false,
"mangle": false
}
},
"module": {
"type": "umd"
},
"minify": false,
"isModule": false
}
Playground link (or link to the minimal reproduction)
SWC Info output
No response
Expected behavior
The code should be polyfilled using the core-js object/get-own-property-descriptors
polyfill.
Actual behavior
No response
Version
1.3.100
Additional context
No response
Polyfill is injected only in preset-env
mode.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.