vite-plugin-image-optimizer icon indicating copy to clipboard operation
vite-plugin-image-optimizer copied to clipboard

Support vitepress

Open vchernin opened this issue 1 year ago • 1 comments

Describe the feature you'd like to request

Vitepress is a static site generator for markdown pages. It uses vite under the hood and users can add plugins like this one. Unfortunately, vitepress has potential for new issues because it customizes the vite build on its own.

Describe the solution you'd like

Support for vitepress.

Some oddities I've found:

  • closeBundle() is called twice, presumably because vitepress builds bundles for the client and the server to support SSR. So if you have a bunch of images in the public directory, they will be compressed twice (putting timestamps at the start at end of close bundle seems to confirm the work is being doubled).
  • The paths as found by closeBundle() seem to be semi broken, although that may not be exclusive to vitepress, that issue for me is fixed by https://github.com/FatehAK/vite-plugin-image-optimizer/pull/41.

Additional context

No response

Validations

  • [X] Read the docs.
  • [X] Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.

vchernin avatar Jun 30 '24 03:06 vchernin

this also seems to apply to Remix, but I imagine using the cache option would dramatically reduce the work being done (even if the files are looked at a second time)

npham-dev avatar Sep 26 '24 06:09 npham-dev