Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won't optimize any images in "public" with Remix #44

Open
2 tasks done
natmfat opened this issue Sep 26, 2024 · 1 comment
Open
2 tasks done

Won't optimize any images in "public" with Remix #44

natmfat opened this issue Sep 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@natmfat
Copy link

natmfat commented Sep 26, 2024

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 when includePublic true.

Steps to reproduce

  1. pnpm create vite & select "Remix"
  2. pnpm add vite-plugin-image-optimizer sharp svgo -D
  3. add ViteImageOptimizer({ includePublic: true }) to vite.config.ts
  4. add some images (or not, Remix comes with a few logos)

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 Info

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

Used Package Manager

pnpm

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@natmfat natmfat added the bug Something isn't working label Sep 26, 2024
@MrVauxs
Copy link

MrVauxs commented Nov 18, 2024

The same happens for SvelteKit (^2.7.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants