Open 0xAskar opened 1 year ago
The reason for the "ReferenceError: window is not defined" error message is that the code is attempting to access the window object, which is only available in web browsers but not in Node.js. The window object is a global object in web browsers that provides access to the browser's window and DOM APIs.
The charting_library.standalone.js module you are attempting to import is intended to be used in a web browser, and it assumes that the window object is available. However, when you try to run this module in Node.js using the import statement, you are executing it in a non-browser environment where the window object is not defined, resulting in the error message.
So I suggest you move it to a different place, maybe where you think is best for you and make reference to it.
Is there any tutorial or example that explains how to work with this library in Nextjs? I keep getting
window is not defined
error coming from the .standalone file. Not sure how to define window despite being in client side especially when the error is coming from thecharting_library.standalone
file.The error occurs at the
import TradingView from "../../chart/charting_library_clonned_data/charting_library/charting_library.standalone";
line and it then says window isn't defined.