When pluginEntry() and pluginImage() are enabled at the same time, one of the following issues occurs depending on the order of the plugins in minista.config.js.
Steps to reproduce
// minista.config.js
import { defineConfig, pluginSsg, pluginEntry, pluginImage } from "minista"
export default defineConfig({
plugins: [pluginSsg(), pluginEntry(), pluginImage()],
})
// src/pages/index.jsx
import { Image } from "minista/assets"
export default function () {
return <Image src="/src/assets/images/photo.png" alt="photo" />
}
Run:
Actual behavior
Pattern 1: pluginEntry → pluginImage
The build fails with the following error:
[plugin vite-plugin:minista-image]
TypeError: Cannot destructure property 'fileName' of 'recipe' as it is undefined.
at resolveOptimizeOption (.../plugins/image/utils/option.js:16:11)
at selfGetElData (.../plugins/image/index.js:253:22)
at PluginContextImpl.generateBundle (.../plugins/image/index.js:481:55)
Pattern 2: pluginImage → pluginEntry
The build succeeds, but an extra unreferenced, unoptimized copy of the original image is emitted to dist/assets/ (for example, photo-XXXXXXXX.png).
The <img> element in dist/index.html correctly references the optimized srcset, so the extra file does not affect the rendered result, but an unnecessary asset is included in the build output.
Expected behavior
Using pluginEntry and pluginImage together should build successfully regardless of plugin order, without emitting unnecessary duplicate assets.
When
pluginEntry()andpluginImage()are enabled at the same time, one of the following issues occurs depending on the order of the plugins inminista.config.js.Steps to reproduce
Run:
Actual behavior
Pattern 1:
pluginEntry→pluginImageThe build fails with the following error:
Pattern 2:
pluginImage→pluginEntryThe build succeeds, but an extra unreferenced, unoptimized copy of the original image is emitted to
dist/assets/(for example,photo-XXXXXXXX.png).The
<img>element indist/index.htmlcorrectly references the optimizedsrcset, so the extra file does not affect the rendered result, but an unnecessary asset is included in the build output.Expected behavior
Using
pluginEntryandpluginImagetogether should build successfully regardless of plugin order, without emitting unnecessary duplicate assets.