vite
vite copied to clipboard
`SSR`: transform `antd` code slow
Describe the bug
description
I'm using antd
in ssr
mode, everytime startup vite devServer, it took about 40s to start.
I've debug vite
source code in local, and I found that the reason is: https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/transformRequest.ts#L234
I tested three conditions:
- use antd and vite no ssr => fast
- use only vite ssr, no UI lib => fast
- use antd and vite ssr => slow
BTW, I think this is not related to #8850.
Reproduction
https://github.com/hemengke1997/vps-antd-repo
System Info
System:
OS: Windows 10 10.0.22000
CPU: (16) x64 Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz
Memory: 5.39 GB / 23.78 GB
Binaries:
Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 63.0.3239.132
Edge: Spartan (44.22000.120.0), Chromium (103.0.1264.37)
Internet Explorer: 11.0.22000.120
npmPackages:
@vitejs/plugin-react: ^2.0.0 => 2.0.0
vite: ^3.0.4 => 3.0.4
Used Package Manager
pnpm
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.