Skip to content

Commit 841f1d9

Browse files
committed
fix:(css-file-paths) Check current url already has base url
1 parent 4d4b53d commit 841f1d9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/lib/src/prod/expose-production.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,19 @@ export function prodExposePlugin(
9999
leading: (path) => (path.startsWith('/') ? path.slice(1) : path)
100100
}
101101
const isAbsoluteUrl = (url) => url.startsWith('http') || url.startsWith('//');
102-
102+
103103
const cleanBaseUrl = trimmer.trailing(baseUrl);
104104
const cleanCssPath = trimmer.leading(cssPath);
105105
const cleanCurUrl = trimmer.trailing(curUrl);
106-
106+
107107
if (isAbsoluteUrl(baseUrl)) {
108108
href = [cleanBaseUrl, cleanCssPath].filter(Boolean).join('/');
109109
} else {
110-
href = [cleanCurUrl + cleanBaseUrl, cleanCssPath].filter(Boolean).join('/');
110+
if (cleanCurUrl.includes(cleanBaseUrl)) {
111+
href = [cleanCurUrl, cleanCssPath].filter(Boolean).join('/');
112+
} else {
113+
href = [cleanCurUrl + cleanBaseUrl, cleanCssPath].filter(Boolean).join('/');
114+
}
111115
}
112116
} else {
113117
href = cssPath;

0 commit comments

Comments
 (0)