Skip to content

Commit

Permalink
fix: avoid partial names replacement when aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
Anidetrix committed Dec 28, 2020
1 parent 06b9b96 commit f5aa1e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/loaders/postcss/import/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const plugin: PluginCreator<ImportOptions> = (options = {}) => {

// Resolve aliases
for (const [from, to] of Object.entries(alias)) {
if (!url.startsWith(from)) continue;
if (url !== from && !url.startsWith(`${from}/`)) continue;
url = normalizePath(to) + url.slice(from.length);
}

Expand Down
2 changes: 1 addition & 1 deletion src/loaders/postcss/url/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const plugin: PluginCreator<UrlOptions> = (options = {}) => {
walkUrls(parsed, (url, node) => {
// Resolve aliases
for (const [from, to] of Object.entries(alias)) {
if (!url.startsWith(from)) continue;
if (url !== from && !url.startsWith(`${from}/`)) continue;
url = normalizePath(to) + url.slice(from.length);
}

Expand Down

0 comments on commit f5aa1e2

Please sign in to comment.