Skip to content

Commit

Permalink
fix(webpack): correctly handle paranthesis in PostCSS in url (#21884)
Browse files Browse the repository at this point in the history
  • Loading branch information
danzrou authored and jaysoo committed Feb 23, 2024
1 parent 71ae788 commit a1e22c0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export function PostcssCliResources(options: PostcssCliResourcesOptions) {
return Promise.all(
urlDeclarations.map(async (decl) => {
const value = decl.value;
const urlRegex = /url(?:\(\s*['"]?)(.*?)(?:['"]?\s*\))/g;
const urlRegex = /url(?:\(\s*(['"]?))(.*?)(?:\1\s*\))/g;
const segments: string[] = [];
let match;
let lastIndex = 0;
Expand All @@ -162,7 +162,7 @@ export function PostcssCliResources(options: PostcssCliResourcesOptions) {
const context =
(inputFile && path.dirname(inputFile)) || loader.context;
while ((match = urlRegex.exec(value))) {
const originalUrl = match[1];
const originalUrl = match[2];
let processedUrl;
try {
processedUrl = await process(originalUrl, context, resourceCache);
Expand Down

0 comments on commit a1e22c0

Please sign in to comment.