我正在使用带有 Next.js 的客户快递服务器。它在容器内运行。我正在做一个http请求isomorphic-fetch
获取我的渲染数据。我想做localhost
当在服务器上运行时mysite.com
在客户端运行时。不确定实现此目的的最佳方法。我可以通过这样做来简单地做到这一点const isServer = typeof window === 'undefined'
但这似乎很糟糕。
现在(2020年1月)应该是typeof window === 'undefined'
since process.browser
已弃用
参考https://github.com/zeit/next.js/issues/5354#issuecomment-520305040 https://github.com/zeit/next.js/issues/5354#issuecomment-520305040
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)