vite icon indicating copy to clipboard operation
vite copied to clipboard

`SSR`: transform `antd` code slow

Open hemengke1997 opened this issue 1 year ago • 0 comments

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:

  1. use antd and vite no ssr => fast
  2. use only vite ssr, no UI lib => fast
  3. 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

hemengke1997 avatar Jul 29 '22 10:07 hemengke1997