Skip to content

Commit

Permalink
fix: use toBuffer/writeFile instead of toFile because of problem in s…
Browse files Browse the repository at this point in the history
…harp
  • Loading branch information
pzerelles committed Nov 29, 2023
1 parent 2b007e1 commit c20f342
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export function imagetools(userOptions: Partial<VitePluginOptions> = {}): Plugin
outputMetadatas.map(async (metadata) => {
const { format, image, imageID } = metadata
const imagePath = `${pluginOptions.cacheDir}/${cacheID}/${imageID}.${format}`
if (image) await image.toFile(imagePath)
if (image) await writeFile(imagePath, await image.toBuffer())
metadata.imagePath = imagePath
if (viteConfig.command === 'serve') {
generatedImages.set(id, metadata)
Expand Down

0 comments on commit c20f342

Please sign in to comment.