[bug] Nextjs Class extends value undefined Immediate on Import #320
Replies: 6 comments
-
Did you tried to import it with:
(note the braces around variable declaration) This error means there is a circular import somewhere. |
Beta Was this translation helpful? Give feedback.
-
Hi @alkihis yes i did try, same error. |
Beta Was this translation helpful? Give feedback.
-
Please install manually |
Beta Was this translation helpful? Give feedback.
-
hi added to my fallback still the same error. thank you for the suggestion |
Beta Was this translation helpful? Give feedback.
-
One thing worth noting. If I remove the fallback{XXX: false} variables i have set in my next.config file the Class extends value undefined error goes away. So that is what is causing the error i think The issue is if I don't have this then I get
Which after googling makes sense because fs is not available in the browser. But I am importing the twitter-api-v2 library inside my ./pages/api directory which I thought would work fine with nodejs functionality, but I am clearly wrong about this. If anyone knows where I can most import and query the twitter api from within a nextjs app then I think that would solve my error since I would then not need to change up the config file which will fix the extends value undefined error. |
Beta Was this translation helpful? Give feedback.
-
As this isn't an issue with the lib and more a configuration issue of how use Node.js libraries in Next, I convert this issue as a discussion :) |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
I am trying to indicate this library with my nextjs app but it is not working right off of installation crashes on the first import statement.
My code is super basic just trying to query a tweet.
Expected behavior
A clear and concise description of what you expected to happen.
I am hoping to be able to query a tweet when the function is called
Version
Additional context
Again I think this has something to do with me using nextjs (v12.0.3) even if i comment all my code out and leave the import statement the app still crashes.
The error that I am getting is
Worth noting before i was receiving a different error
But i was able to resolve this by adding
to my next.config file
i had this error for each of these separately the crypto error was just one example so i did false for each that it appeared and that solved this problem.
The constructor error message is now what is blocking me.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions