Current Behavior
The output is undefined
in IE10.
Input Code
function A() {}
A.prototype.a = 'aaa';
class B extends A {}
console.log(B.prototype.a);
Expected behavior/code
Expect output aaa
, but got undefined
in IE10. I also tested this in @vue/[email protected]
, it have the same problem.
Babel Configuration (.babelrc, package.json, cli command)
Environment
cli
, register
, loader
]Possible Solution
Additional context/Screenshots
Hey @sorrycc! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.
Any progress on this?
use setprototypeof
import '@babel/polyfill'
Object.setPrototypeOf = require('setprototypeof')
update:
how to polyfill Object.getPrototypeOf
setprototypeof
can't make getPrototypeOf helper work, but I have a workaround:
module.exports =
Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array ? setProtoOf : mixinProperties)
function setProtoOf(obj, proto) {
obj.__proto__ = proto
return obj
}
function mixinProperties(obj, proto) {
// make getPrototypeOf helper work
Object.defineProperty(obj, '__proto__', {
value: proto,
})
for (var prop in proto) {
if (!obj.hasOwnProperty(prop)) {
obj[prop] = proto[prop]
}
}
return obj
}
Most helpful comment
use
setprototypeof
update:
how to polyfillObject.getPrototypeOf
setprototypeof
can't make getPrototypeOf helper work, but I have a workaround: