
Based on sharp.js, compress your image before vite generate bundle. It's easy and fast! 基于sharp.js的vite图片压缩插件,又快又好用!
The vite-plugin-minipic is an efficient image compression tool designed specifically for modern Vite projects. With an emphasis on speed and ease of use, it empowers developers to optimize their image assets quickly, achieving remarkable compression ratios while maintaining quality. Ideal for projects that handle numerous images, this plugin simplifies the process without sacrificing performance or convenience.
By leveraging the power of sharp.js, minipic achieves impressive compression speeds, ensuring that even large sets of images can be processed in seconds. This makes it an invaluable addition to any developer's toolkit, especially when working with projects that are image-heavy.
Fast Compression Speed: Minipic boasts incredibly fast compression powered by sharp.js, allowing users to compress 40 MB of images in just 3 seconds, achieving a compression ratio of 70% to 80%.
Cache Control: The plugin includes built-in cache control that saves compressed images to disk, ensuring subsequent compressions read directly from the cache for quicker processing.
Convert Image Types: Users have the flexibility to change the image type during the compression process, allowing for streamlined asset management.
Include/Exclude Specific Image Types: Minipic allows developers to specify which image types they want to compress, offering tailored compression based on project requirements.
Public Folder Support (Version ≥ 1.1): The plugin supports the compression of images located in the public folder, giving even more versatility in asset management.
Easy Installation: Compatible with various package managers, minipic can be easily installed using popular methods like Yarn or Pnpm.
Configurable Options: Offers various configuration parameters that can be adjusted in the vite.config.js file to suit your specific compression needs, including options for sharp.js and type conversions.

Vite is a build tool that aims to provide a faster and leaner development experience for modern web projects
ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.
RollupJS is a popular and efficient JavaScript module bundler that takes the code from multiple modules and packages them into a single optimized file, minimizing the overall size of the application and improving its performance.
TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.
Webpack is a popular open-source module bundler for JavaScript applications that bundles and optimizes the code and its dependencies for production-ready deployment. It can also be used to transform other types of assets such as CSS, images, and fonts.