-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Spec: Class FieldsoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
I have transform-class-properties enabled, but super calls in bound class methods do not work (webpack aborts transpilation).
Input Code
class B {
c() {
}
}
class Works extends B {
c() {
super.c();
}
}
class Fails extends B {
c = () => {
super.c();
}
}Babel Configuration (.babelrc, package.json, cli command)
{
presets: [
["env", {
"targets": {
"browsers": [
"last 3 Chrome versions",
"last 3 Firefox versions",
"last 2 Edge versions",
"last 1 Safari versions",
"last 1 iOS versions"
]
},
"exclude": [
"transform-regenerator"
]
}],
"react",
],
plugins: [
"transform-async-to-generator",
"transform-class-properties",
"transform-flow-strip-types",
]
}Expected Behavior
It should transpile successfully and make the super call.
Current Behavior
Webpack aborts transpilation.
Possible Solution
As a workaround, I currently use SuperClassName.prototype.methodName.call(this); instead of super.methodName() as a work around. I think the transpiler could generate exactly the same?
Your Environment
| software | version |
|---|---|
| Babel | 6.21.0 |
| node | 5.10.1 |
| npm | 3.8.3 |
| Operating System | Win10 |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Spec: Class FieldsoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue