Skip to content

[Bug]: https://rsbuild.dev/zh/guide/migration/vite error #4975

@LiryCcc

Description

@LiryCcc

Version

System:
  OS: Windows 11 10.0.26100
  CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700
  Memory: 29.43 GB / 63.63 GB
Browsers:
  Edge: Chromium (134.0.3124.51)

Details

在标题所写的页面浏览器控制台报错

Uncaught Error: Minified React error #418; visit https://react.dev/errors/418?args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
    at r_ (lib-react.e9a5f7de.js:2:34135)
    at lib-react.e9a5f7de.js:2:116827
    at ud (lib-react.e9a5f7de.js:2:119608)
    at us (lib-react.e9a5f7de.js:2:111969)
    at lib-react.e9a5f7de.js:2:111753
    at uu (lib-react.e9a5f7de.js:2:111761)
    at i9 (lib-react.e9a5f7de.js:2:108191)
    at uj (lib-react.e9a5f7de.js:2:129549)
    at uA (lib-react.e9a5f7de.js:2:127788)
    at uy (lib-react.e9a5f7de.js:2:125482)

对应到react官网,报错内容为

Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:

- A server/client branch `if (typeof window !== 'undefined')`.
- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
- Date formatting in a user's locale which doesn't match the server.
- External changing data without sending a snapshot of it along with the HTML.
- Invalid HTML tag nesting.

It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.

https://react.dev/link/hydration-mismatch

Reproduce link

null

Reproduce Steps

  1. 打开https://rsbuild.dev/zh/guide/migration/vite
  2. 命令框选择pnpm
  3. 刷新浏览器
  4. 打开控制台即可看见错误

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions