sunny-green
sunny-green2y ago

How to have access window on next.config.js?

Does someone know how to get access to window variable on next.config.js i will need to read the window.location path. Thanks
4 Replies
Omer
Omer2y ago
Hey @jos3 , You cannot access the window object from next.config.js. The window object can only be accessed through the browser
sunny-green
sunny-green2y ago
Thanks Ömer, will try to find another way. btw @Omer do you know any other way to access url path on next.config.js with useRouter maybe?
Omer
Omer2y ago
I think this is not possible but you can also ask on Next.js discord server
sunny-green
sunny-green2y ago
I've already asked, hopefully someone have an answer, thanks again