Skip to content

Commit

Permalink
fix: crash when using filesystem cache (#461)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait authored Dec 18, 2024
1 parent 4e26a1e commit 383d3d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ async function loader(content) {
ABSOLUTE_URL_REGEX.test(this.resourcePath) &&
!WINDOWS_PATH_REGEX.test(this.resourcePath)
? this.resourcePath
: this.utils.contextify(this.rootContext, this.resourcePath);
: path.relative(this.rootContext, this.resourcePath);

const minifyOptions =
/** @type {import("./index").InternalWorkerOptions<T>} */ ({
Expand Down
6 changes: 3 additions & 3 deletions test/ImageminPlugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ describe("imagemin plugin", () => {
const stringStats = stats.toString({ relatedAssets: true });

expect(stringStats).toMatch(
/asset loader-test.webp.+\[from: .+loader-test.png\] \[generated\]/,
/asset loader-test.webp.+\[from: loader-test.png\] \[generated\]/,
);
});

Expand Down Expand Up @@ -1386,7 +1386,7 @@ describe("imagemin plugin", () => {
expect(warnings).toHaveLength(0);
expect(errors).toHaveLength(1);
expect(errors[0].message).toMatch(
/Multiple values for the 'encodeOptions' option is not supported for '.+loader-test.png', specify only one codec for the generator/,
/Multiple values for the 'encodeOptions' option is not supported for 'loader-test.png', specify only one codec for the generator/,
);
});

Expand Down Expand Up @@ -1771,7 +1771,7 @@ describe("imagemin plugin", () => {
expect(warnings).toHaveLength(0);
expect(errors).toHaveLength(1);
expect(errors[0].message).toMatch(
/Error with '.+loader-test.txt': Input file has an unsupported format/g,
/Error with 'loader-test.txt': Input file has an unsupported format/g,
);
});

Expand Down

0 comments on commit 383d3d3

Please sign in to comment.