question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pre-bundling is very slow when including ant-design-vue

See original GitHub issue

Describe the bug

As the title says, when I include ant-design-vue, in my tests, it takes about 41.13s, which is very, very slow.

image

A reproducible project: https://github.com/rxliuli/vite-vue-perf-demo, in fact, I only refer to the Button component

import { createApp } from 'vue'
import App from './App.vue'
import 'ant-design-vue/dist/antd.css'
import { Button } from 'ant-design-vue'

console.log(Button)
createApp(App).mount('#app')

The log is obtained using the following command

pnpm vite --debug --force 2>&1 | tee vite.log

I observed that when the library contains a lot of code like import isPlainObject from 'lodash-es/isPlainObject';, vite goes to every file, which is very, very slow, as you can see from the log @ ant-design/icons-vue appears 104 times, while @ant-design/icons-svg appears 1578 times.

When I tried to rewrite import isPlainObject from 'lodash-es/isPlainObject'; to import { isPlainObject } from 'lodash-es'; using the esbuild plugin, the performance became acceptable (it only took a few seconds) .

My question now is, if there is such a dependency, can vite do some automatic optimizations, in fact echarts/maplibre-gl has a similar problem, or do I need to make separate PRs for these projects?

ref: https://github.com/vitejs/vite/discussions/7857#discussioncomment-3045849

Reproduction

https://github.com/rxliuli/vite-vue-perf-demo

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (16) x64 Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz
    Memory: 38.26 GB / 63.87 GB
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.18 - ~\AppData\Local\pnpm\yarn.CMD
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @vitejs/plugin-vue: ^2.3.3 => 2.3.3
    vite: ^2.9.9 => 2.9.13

Used Package Manager

pnpm

Logs

Click to expand!

vite.log

Validations

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:7
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
core-admincommented, Jul 25, 2022

换个包管理工具试试,我使用pnpm安装的依赖,在冷启动阶段长达1分钟多,我后来换成了npm,发现冷启动快多了,不知道什么问题,其中@ant-design/icons-vue 目前是被rollup全量处理的,可以看下这个issues:https://github.com/vueComponent/ant-design-vue/issues/5822。


Try another package management tool. I used the dependency of pnpm installation, which lasted for more than 1 minute in the cold start phase. Later, I changed to NPM, and found that the cold start was much faster. I don’t know what the problem was. Among them, @ant design / icons Vue is currently fully handled by rollup. You can see this issue: https://github.com/vueComponent/ant-design-vue/issues/5822

0reactions
rxliulicommented, Oct 26, 2022

This issue doesn’t seem to be resolved, currently, the cold start speed has been as high as 1min, and vite seems to be no longer available on large projects

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimize the Performance of a Vue App with Async Components
In this article, I'll demonstrate how make use of both asynchronous components and webpack's code-splitting functionality to load in parts of the page...
Read more >
Very slow input elements in Ant Design Form - Stack Overflow
I am using React and Ant Design for React, and I'm trying to build a form with 10 to 15 input elements. The...
Read more >
esbuild tsconfig paths - Viajando com a Cintia
Tsconfig paths Projects scaffolded via create-vue include pre-configured ... built-in resolvers for popular UI libraries like Vuetify, Ant Design Vue, ...
Read more >
MUI, is it that bad? : r/reactjs - Reddit
MUI was using JSS under the hood prior to v5, and it was indeed slower ... Its not VERY slow but it is...
Read more >
How to drastically reduce your bundle size and load time in ...
Here's how we reduced the bundle size and load time of our Vue.js app. ... Are you satisfied with the time it takes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found