-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
next 中报错 window is undefined #231
Comments
@Shunjun 你可以参考 uiwjs/react-md-editor#52 (comment) 类似的解决方法。 |
@Shunjun 提供一个可行的NextJS (v12.2) 加载方法: // components/react-amap-api-loader.ts
import { ComponentType } from 'react';
import { APILoaderConfig } from '@uiw/react-amap-api-loader';
import dynamic from 'next/dynamic';
export const APILoader: ComponentType<APILoaderConfig> = dynamic(
() => import('@uiw/react-amap-api-loader').then((mod: any) => mod.APILoader),
{ ssr: false },
); 引入的时候注意需要避免引入整个包,不然api-loader的export又会被加载了。 不需要安装 |
请问您这个问题解决了吗,我目前也出现了window is undefined. |
我按照他的方式,还是会出现这个问题。 |
@jaywcjlove 谢谢,已解决~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
APILoader 的 defaultProps 中,从 window 上获取 protocol 会导致在 next ssr 时报 window is undefined。
能否添加一个 window 的判断再获取 protocol
The text was updated successfully, but these errors were encountered: