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
I am a first time user of Vite, trying to give it a go. An issue I've ran into straight away is building for production library mode seems to copy all files and folders from public, even though the entry point is a super simple basic js file that doesn't import any of the files it's copied.
If you take a look at the reproduction url take a look at the dist folder that vite has built - it included these files and folder:
For our project those folders that it's copying is absolutely huge (gigabytes) and it actually looks like it's frozen the build process whilst it's copying all those files. Those public files aren't even used at all or referenced anywhere in the js - they just happen to sit in public because they should be publicly accessible, but have nothing to do with our build tools or bundle.
This is quite a frustrating experience as first timer coming to Vite. I've never experienced a bundler copy such a mass amount of files that weren't even referenced in the bundle.
Is this a bug? Or if it's working as intended, is it a sensible default? Is there somewhere in the docs I'm missing?
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
This is a problem if you are building a library and you put any files not related to production output inside /public directory. Let's say you have example image files you use as props (URL or path to those images) when developing React components in Storybook (with vite builder which started using a single vite.config). I think these files should not be part of a NPM package unless specifically selected (or configured).
I just thought of a suggestion, which is getting the total size of publicDir before copying (also a recursive action) and emitting a warning if the total size or total number of files crosses a certain threshold. the check can be skipped if options have been explicitly set.
Describe the bug
I am a first time user of Vite, trying to give it a go. An issue I've ran into straight away is building for production
library mode
seems to copy all files and folders from public, even though the entry point is a super simple basic js file that doesn't import any of the files it's copied.If you take a look at the reproduction url take a look at the
dist
folder that vite has built - it included these files and folder:For our project those folders that it's copying is absolutely huge (gigabytes) and it actually looks like it's frozen the build process whilst it's copying all those files. Those public files aren't even used at all or referenced anywhere in the js - they just happen to sit in public because they should be publicly accessible, but have nothing to do with our build tools or bundle.
This is quite a frustrating experience as first timer coming to Vite. I've never experienced a bundler copy such a mass amount of files that weren't even referenced in the bundle.
Is this a bug? Or if it's working as intended, is it a sensible default? Is there somewhere in the docs I'm missing?
Reproduction
https://stackblitz.com/edit/vitejs-vite-bf6npy?file=main.js,public%2Fvite.svg&terminal=dev
Steps to reproduce
No response
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: