antoniandre / vue-cal

A Vue.js full calendar, no dependency, no BS. :metal:
https://antoniandre.github.io/vue-cal/
MIT License
1.23k stars 234 forks source link

Tree shaking: built assets include all locales #494

Open rubjo opened 2 years ago

rubjo commented 2 years ago

https://stackblitz.com/edit/vuecal-vite-esm?file=src%2FApp.vue

Downloaded this, npm i and npm run build leads to dist/assets containing separate files for all locales (plus drag-and-drop).

Is it possible to import just vue-cal without locales or extras? I'm setting my own locale object anyway, so I don't need any file to be built for that.

antoniandre commented 2 years ago

Hi @rubjo, having all these locale files as assets is not an issue and will not impact your site load time as these files are on-demand chunks. They are here only if you use this locale, then it will pull the corresponding module and load it. And the cool thing about it, is that you don't have to worry about importing the files separately as it would now resolve lazy loaded imports by itself.

That being said, I also understand it kinda creates noise for you if you don't need. I will see if I can find a way to bundle differently, but with Rollup builds it's quite difficult to achieve and control dynamic import chunks.

dergunovs commented 2 years ago

First, thanks for this package. We use it in out project. But those unused files are indeed spoils the impression. If you will find the solution to exclude them from build, it will be great.

rubjo commented 1 year ago

Thanks for replying @antoniandre. I do realize that locale files are lazily loaded anyway, but how production files are deployed probably varies a lot from place to place. In one scenario for me (admittedly this is weird), allowed files on the end server are actually explicitly whitelisted, so I have to manually deselect all the vue-cal locale files before I push the dist out :) I guess I could whitelist all the individual locale files as well, although they are not being used.