Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/plugins/next-image/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "node:fs";
import { createRequire } from "node:module";
import path from "node:path";
import { decode } from "node:querystring";
import { decode, encode } from "node:querystring";
import { imageSize } from "image-size";
import type { NextConfigComplete } from "next/dist/server/config-shared.js";
import { dedent } from "ts-dedent";
Expand Down Expand Up @@ -54,7 +54,7 @@ export function vitePluginNextImage(
: path.join(path.dirname(importer), source)
: source;

return `${virtualImage}?imagePath=${imagePath}`;
return `${virtualImage}?${encode({ imagePath })}`;
}

if (id === "next/image" && importer !== virtualNextImage) {
Expand Down Expand Up @@ -117,7 +117,7 @@ export function vitePluginNextImage(
};
`;
} catch (err) {
console.error(`Could not read font file ${imagePath}:`, err);
console.error(`Could not read image file ${imagePath}:`, err);
return undefined;
}
}
Expand Down