diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f82d57..9158a08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [4.1.2](https://github.com/webpack-contrib/image-minimizer-webpack-plugin/compare/v4.1.1...v4.1.2) (2024-12-16) + + +### Bug Fixes + +* webpack compilations fail when using filesystem cache [#458](#458) + ### [4.1.1](https://github.com/webpack-contrib/image-minimizer-webpack-plugin/compare/v4.1.0...v4.1.1) (2024-11-19) diff --git a/package.json b/package.json index 8675801..150b55c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "image-minimizer-webpack-plugin", - "version": "4.1.1", + "version": "4.1.2", "description": "Webpack loader and plugin to optimize (compress) images using imagemin", "license": "MIT", "repository": "webpack-contrib/image-minimizer-webpack-plugin", diff --git a/src/loader.js b/src/loader.js index b90cbf3..597f16d 100644 --- a/src/loader.js +++ b/src/loader.js @@ -204,10 +204,12 @@ async function loader(content) { } let isAbsolute = isAbsoluteURL(this.resourcePath); + const isData = this.resourcePath.startsWith("DATA:"); + const shouldMakeRelative = !isData && isAbsolute; - const filename = isAbsolute - ? this.resourcePath - : path.relative(this.rootContext, this.resourcePath); + const filename = shouldMakeRelative + ? path.relative(this.rootContext, this.resourcePath) + : this.resourcePath; const minifyOptions = /** @type {import("./index").InternalWorkerOptions} */ ({ diff --git a/test/ImageminPlugin.test.js b/test/ImageminPlugin.test.js index b4c0610..bbb8dbf 100644 --- a/test/ImageminPlugin.test.js +++ b/test/ImageminPlugin.test.js @@ -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\]/, ); }); @@ -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/, ); }); @@ -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, ); });