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

[Question] Bundle/split external dependencies only #1781

Open
richarddd opened this issue Nov 17, 2021 · 3 comments
Open

[Question] Bundle/split external dependencies only #1781

richarddd opened this issue Nov 17, 2021 · 3 comments

Comments

@richarddd
Copy link

Hi,

Is there any way to create "two" bundles. One with my sources and another one with my dependencies?
The main bundle should import the dependencies bundle.

Regards
Richard

@hyrious
Copy link

hyrious commented Nov 17, 2021

@richarddd richarddd reopened this Nov 17, 2021
@richarddd
Copy link
Author

@hyrious i opened this issue again because it's not an optimal solution. This will bundle ALL external dependencies and not just the ones you are using create a vendor.js bundle that is very large (in my case 15x larger than when everything is bundled in one file)

@hyrious
Copy link

hyrious commented Nov 18, 2021

Yes this is just a quick solution but not optimal one. To analyze dependencies that are really in use, you must bundle once and look in the metafile, instead of just reading package.json.

I'll suggest using vite to do this work for you, since it hooks into build process and automatically split dependencies into a vendor.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants