Open natmfat opened 2 months ago
I'm using Vite with Remix. For some reason, images that are imported in the app directory are optimized, but images in the public directory or not, even when includePublic true.
app
includePublic
pnpm create vite
pnpm add vite-plugin-image-optimizer sharp svgo -D
ViteImageOptimizer({ includePublic: true })
Alternatively, clone this repo to reproduce: https://github.com/natmfat/bug-vite-plugin-image-optimizer
> pnpm run build ... ✨ [vite-plugin-image-optimizer] - optimized images successfully: server/assets/portfolio-home-DOw3Ebwk.png -73% cached original: 336.98 kB; cached: 92.32 kB
I expected images in the "public" directory to be transformed as well, not just ones that are imported.
System: OS: macOS 14.6.1 CPU: (8) arm64 Apple M2 Memory: 289.22 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.16.0 - ~/.nvm/versions/node/v20.16.0/bin/node npm: 10.8.1 - ~/.nvm/versions/node/v20.16.0/bin/npm pnpm: 9.6.0 - ~/Library/pnpm/pnpm Browsers: Chrome: 129.0.6668.71 Safari: 17.6 npmPackages: vite: ^5.1.0 => 5.4.8 vite-plugin-image-optimizer: ^1.1.8 => 1.1.8 vite-tsconfig-paths: ^4.2.1 => 4.3.2
pnpm
The same happens for SvelteKit (^2.7.3)
Describe the Bug
I'm using Vite with Remix. For some reason, images that are imported in the
app
directory are optimized, but images in the public directory or not, even whenincludePublic
true.Steps to reproduce
pnpm create vite
& select "Remix"pnpm add vite-plugin-image-optimizer sharp svgo -D
ViteImageOptimizer({ includePublic: true })
to vite.config.tsAlternatively, clone this repo to reproduce: https://github.com/natmfat/bug-vite-plugin-image-optimizer
I expected images in the "public" directory to be transformed as well, not just ones that are imported.
System Info
Used Package Manager
pnpm
Validations