-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class constructors must be invoked with |new| #5
Comments
that is suppose to detect your component is a react component. what does it returns? |
I modified that call to be like this:
When I debug it, isClass is {} (an empty object). |
this is what suppose to be there hmmmmm |
try
|
Same Result |
Yes, our webpack is
|
react 16.7.0? |
I could've sworn it was 16.7, but it looks like it's 16.6, updating now, will retest |
plesae try
|
Updated to React 16.7, also changed to using that import. No change, same error. |
it might be related to |
also, by reading babel/babel#7022 |
ok, please try |
Fixed it for me :). Much thanks |
i belive what we see is a transpiled by babel class trying to extend a not transpiled class. asked about this in reddit: |
I pulled your branch as recommended and it now appears to be working. |
fixed in v2.5.0. If you are not transpiling your classes, the library should be built without class transpilations as well. So we added 3 endpoints where it is indeed not transpiled:
to use it, import the library like this:
|
@screaney does it works for you? also notice we can eliminate these endpoints once babel/babel#8656 is merged. |
Finally was able to create a workaround. I'm extending an existing babel config that covers both client and server and I'm running into this on the node side of things. But the key is to exclude
|
again:
another way to fix it is to enable
|
Same error here using the
My browserlist:
Maybe you should re-open this issue. |
Getting the same issue as @frederikhors using create-react-app. Is there any workaround? |
I don't see this bug in the sandbox: try to reproduce it please. |
I think i get it.
The the |
I have given it a go with the default version but no luck.I get the same error "TypeError: Class constructor Dashboard cannot be invoked without 'new'" After some messing around I got it working in some components and realised it is failing in all the components with react-redux's connect import. |
are you using the last react-redux version? |
Was on version 5.1.0, just updated to 7.1.0 but same error using both versions of the library. I will see if I can recreate the error in a sandbox. |
I decided to close this issue since I understand very well why it happens and that it is solved already: If anybody has new information and / or able to reproduce it here: I'll obviously re-open it. |
* make logOwnerReasons true by default. * only trackHooks if they are supported. * removed building without .babel-plugin-transform-classes because babel fixed it in their newer versions. removed a mention to this from readme. this closes #5 closes #131. * removed babel-plugin-lodash - we don't really care about the bundle size and also the user of the library might use their own lodash optimizations instead. * we only build a "umd" version now. Since the package is only for development, we don't really care about different build types. * improved readme in general, including the installation tips. this closes #130.
* make logOwnerReasons true by default. * only trackHooks if they are supported. * removed building without .babel-plugin-transform-classes because babel fixed it in their newer versions. removed a mention to this from readme. this closes #5 closes #131. * removed babel-plugin-lodash - we don't really care about the bundle size and also the user of the library might use their own lodash optimizations instead. * we only build a "umd" version now. Since the package is only for development, we don't really care about different build types. * improved readme in general, including the installation tips. this closes #130.
Trying to implement base functionality on our existing React app.
Getting
for any component I add the static property to.
It looks like this is a common issue across this library and the predecessors, but I was under the impression this library had it solved, so I must be missing something.
I've attached the library via NPM as well as manually adding the src to see if I could narrow it down. Best I can tell the error is thrown here (line 505):
_this = _possibleConstructorReturn(this, _getPrototypeOf(WDYRPatchedClassComponent).call(this, props, context));
Excluding markup, my component looks like this:
`class Home extends React.Component {
constructor(props) {
super(props);
}
static whyDidYouRender = true;
render(){
...
}
export default Home;
`
The text was updated successfully, but these errors were encountered: