Ignore public directories at build time
When developing with the vite development environment, you may need to use assets under public. If the target of the build does not depend on this part of the assets, ignore some of them at build time and do not copy them to the dist directory. vite will duplicate them by default, and there is no way to turn off this behavior yet, use this plugin to fix it.
npm i -D vite-plugin-ignore-public
Add plugin to your vite.config.ts
:
// vite.config.ts
import { IgnorePublicPlugin } from 'vite-plugin-ignore-public'
export default {
plugins: [
IgnorePublicPlugin(),
]
}