Link to the code that reproduces this issue
DigitecGalaxus/next-yak#515
To Reproduce
- Create a webpack loader that uses matchResource (
!=!) syntax to emit CSS through mini-css-extract-plugin
- Include a CSS
url() reference to a relative asset (e.g. url(./image.png))
- Build with
next build --webpack
- The url() path resolves against the wrong directory, resulting in broken asset references
Current vs. Expected behavior
Current: mini-css-extract-plugin's importModule ignores the matchResource from !=! requests, causing CSS url() imports to resolve against the original file's context instead of the matchResource path.
Expected: importModule should use the matchResource path for resolution, matching how webpack handles !=! requests elsewhere.
Fixed upstream in webpack/mini-css-extract-plugin#1162 (v2.10.2).
Provide environment information
Which area(s) are affected? (Select all that apply)
Webpack
Which stage(s) are affected? (Select all that apply)
next build (local), next dev (local)
Additional context
The bundled mini-css-extract-plugin is at v2.4.4. The fix landed in v2.10.2.
This blocks any webpack loader using matchResource to emit CSS with relative url() references.
A PR to update the bundled version will follow.
Link to the code that reproduces this issue
DigitecGalaxus/next-yak#515
To Reproduce
!=!) syntax to emit CSS through mini-css-extract-pluginurl()reference to a relative asset (e.g.url(./image.png))next build --webpackCurrent vs. Expected behavior
Current: mini-css-extract-plugin's
importModuleignores thematchResourcefrom!=!requests, causing CSS url() imports to resolve against the original file's context instead of the matchResource path.Expected:
importModuleshould use thematchResourcepath for resolution, matching how webpack handles!=!requests elsewhere.Fixed upstream in webpack/mini-css-extract-plugin#1162 (v2.10.2).
Provide environment information
Which area(s) are affected? (Select all that apply)
Webpack
Which stage(s) are affected? (Select all that apply)
next build (local), next dev (local)
Additional context
The bundled mini-css-extract-plugin is at v2.4.4. The fix landed in v2.10.2.
This blocks any webpack loader using matchResource to emit CSS with relative url() references.
A PR to update the bundled version will follow.