Skip to content
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

服务端渲染报错 window is not defined, #113

Open
qianxuemin opened this issue Jun 5, 2023 · 1 comment
Open

服务端渲染报错 window is not defined, #113

qianxuemin opened this issue Jun 5, 2023 · 1 comment

Comments

@qianxuemin
Copy link

服务端渲染时报错:

版本:@chatui/core@2.4.2

报错信息:
ReferenceError: window is not defined

报错文件:

node_modules/@chatui/core/lib/utils/canUse.js:30:30

 26 |   smoothScroll: function smoothScroll() {
 27 |     return 'scrollBehavior' in document.documentElement.style;
 28 |   },
 29 |   touch: function touch() {
> 30 |     return 'ontouchstart' in window;
    |                              ^
 31 |   }
 32 | };
 33 | 
@frey0415
Copy link

import dynamic from 'next/dynamic';
const Chat = dynamic(() => import('@/components/ChatUI'), {ssr: false});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants