alibaba / alibaba/ChatUI

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

Open
#113 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.4k
Forks
425
PR merge metrics
No merged PRs in 30d

Description

服务端渲染时报错:

版本:@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 |
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with node_modules/@chatui/core/lib/utils/canUse.js at line 30 and reproduce the server-side rendering failure described in the issue. Trace how this utility is reached during SSR; done means server rendering no longer raises ReferenceError: window is not defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.