Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR #6251 generates a HUGE async-vendor chunk dispite the packages are imported from different async chunks #6289

Closed
7 tasks done
QiroNT opened this issue Dec 28, 2021 · 6 comments · Fixed by #6290
Closed
7 tasks done

Comments

@QiroNT
Copy link

QiroNT commented Dec 28, 2021

Describe the bug

PR #6251 introduced a separate chunk for async imports to improve cache hits which is great to have.

The problem is it generates a single chunk for all async imports, which results in all packages imported async-ly to be packed into one huge(in my case >1MB) file.

I think it should be at least keyed chunks so packages from different async chunks will be written separately.

vite v2.7.7:
图片

vite v2.7.8:
图片

Reproduction

https://github.com/QiroNT/vite-reps/tree/vite-6251

System Info

System:
    OS: Linux 5.14 Manjaro Linux
    CPU: (12) x64 AMD Ryzen 5 3600 6-Core Processor
    Memory: 12.65 GB / 31.30 GB
    Container: Yes
    Shell: 5.1.12 - /bin/bash
  Binaries:
    Node: 17.3.0 - ~/.local/share/pnpm/node
    npm: 8.3.0 - ~/.local/share/pnpm/npm
  Browsers:
    Firefox: 95.0.1
  npmPackages:
    @vitejs/plugin-vue: ^2.0.1 => 2.0.1 
    vite: ^2.7.8 => 2.7.8

Used Package Manager

pnpm

Logs

No response

Validations

@QiroNT QiroNT changed the title PR #6251 generate a HUGE async-vendor chunk dispite the packages are imported from different async chunks PR #6251 generates a HUGE async-vendor chunk dispite the packages are imported from different async chunks Dec 28, 2021
@Shinigami92
Copy link
Member

Which tool are you using there? I want to try it out locally and see/compare the chunk sizes.

@QiroNT
Copy link
Author

QiroNT commented Dec 28, 2021

Which tool are you using there? I want to try it out locally and see/compare the chunk sizes.

Just rollup-plugin-visualizer, btw the images are taken from another repo, not the reproduction.

@sanyuan0704
Copy link
Contributor

The critical chunk size may need to be specified for the dynamically imported module, so that the async-vendor is split into different chunks according to the size to avoid excessive chunk size.

@sanyuan0704
Copy link
Contributor

For example, the default minimum chunk size is 200 KB, and the final async-vendor is 500KB, then it will be divided into async-vendor0.js, async-vendor1.js and async-vendor2.js in the end.

@patak-dev
Copy link
Member

patak-dev commented Dec 28, 2021

[email protected] was released with #6251 reverted
It was too big of a change for a patch release, @sanyuan0704 please create another PR addressing this issue and we can work it out for inclusion in a future minor

@sanyuan0704
Copy link
Contributor

[email protected] was released with #6251 reverted It was too big of a change for a patch release, @sanyuan0704 please create another PR addressing this issue and we can work it out for inclusion in a future minor

Okay,i will propose a more specific splitting strategy for async chunk and create a pr again.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants