You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Question] Bundle/split external dependencies only #1781
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
Reacted by Tomáš Szabo, ryneeverett and Petter Bergman
@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)
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.
Activity
hyrious commentedon Nov 17, 2021
https://github.com/hyrious/esbuild-split-vendors-example
richarddd commentedon Nov 17, 2021
@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 commentedon 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.