Skip to content
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

[NEXT.JS] TypeError: Object.defineProperty called on non-object #17

Closed
abnersajr opened this issue Apr 10, 2019 · 18 comments
Closed

[NEXT.JS] TypeError: Object.defineProperty called on non-object #17

abnersajr opened this issue Apr 10, 2019 · 18 comments
Labels
bug Something isn't working cant reproduce Elaboration on how to reproduce the issue is needed help wanted Extra attention is needed more info required

Comments

@abnersajr
Copy link

abnersajr commented Apr 10, 2019

I'm facing issues using NextJs. I'd tried different ways to do it but always the same results.
Even in build mode and dev mode, the issue is the same just change the file names because of the hashes.

I import React globally, so I don't have to put: class NameClass extends React.Component/

I also tried to import in different scenarios mentioned in the doc and also using require and import, but didn't work.

I don't have any modifications in babel plugins and etc, but NextJS have their own.
This is preset:
https://github.com/zeit/next.js/blob/canary/packages/next/build/babel/preset.ts

I think that looking into this you can assume if any plugin is causing this issue.

In this screenshot is the issue when I start a server with builded version:
Screen Shot 2019-04-10 at 10 10 41

@abnersajr
Copy link
Author

Here is a screenshot when I'm running yarn dev, the built-in version:

Screen Shot 2019-04-10 at 10 35 41

@vzaidman
Copy link
Collaborator

Hey!
First of all, I work with the library with next.js as well so the preset is not the problem.

@vzaidman
Copy link
Collaborator

What version of react do you use?

@vzaidman
Copy link
Collaborator

Can you try the trackHooks: false option when initializing the library?

@abnersajr
Copy link
Author

I don't use hooks, but yes I can try. I use the version 16.6.1

@vzaidman
Copy link
Collaborator

can you update to latest react and try again?

@abnersajr
Copy link
Author

Where exactly do you import the WhyDidYouRender?

@vzaidman
Copy link
Collaborator

in _app

@abnersajr
Copy link
Author

abnersajr commented Apr 10, 2019 via email

@vzaidman
Copy link
Collaborator

instead of PR to docs, make a PR that doesn't runs hooks if the hooks object is not on React so we will support older versions.

@vzaidman
Copy link
Collaborator

updated the requirement for the library to version >=16.8

@crapthings
Copy link

this still exist

@vzaidman
Copy link
Collaborator

vzaidman commented Sep 9, 2019

exists on latest react?

@crapthings
Copy link

crapthings commented Sep 9, 2019

image

const whyDidYouRender = require('@welldone-software/why-did-you-render')
console.log(whyDidYouRender)
whyDidYouRender(React);

image

@vzaidman
Copy link
Collaborator

vzaidman commented Sep 9, 2019

What polyfill do you use?

@crapthings
Copy link

default meteor 1.8.1 sets ?

https://github.com/meteor/babel/blob/master/package.json

@vzaidman
Copy link
Collaborator

vzaidman commented Sep 10, 2019

please create a sandbox where it happens or:
use the non-minified version of whyDidYouRender and create some screenshots from debugging of what fails where.
Thanks :)

@vzaidman vzaidman reopened this Sep 10, 2019
@vzaidman vzaidman added bug Something isn't working cant reproduce Elaboration on how to reproduce the issue is needed help wanted Extra attention is needed more info required labels Sep 10, 2019
@vzaidman
Copy link
Collaborator

can be reopened when more information is provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cant reproduce Elaboration on how to reproduce the issue is needed help wanted Extra attention is needed more info required
Projects
None yet
Development

No branches or pull requests

3 participants