Another solution is by using p?r?o?c?e?s?s?.?b?r?o?w?s?e?r
to just execute your command during rendering on the client side only.
But process
object has been deprecated in Webpack5 and also NextJS, because it is a NodeJS variable for backend side only.
So we have to use back window
object from the browser.
if (typeof window !== "undefined") {
// Client-side-only code
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…