Fix webpack config url in css
This commit is contained in:
@@ -252,24 +252,24 @@ module.exports = {
|
|||||||
"options": {
|
"options": {
|
||||||
"postcss": [
|
"postcss": [
|
||||||
autoprefixer(),
|
autoprefixer(),
|
||||||
postcssUrl({"url": (URL) => {
|
postcssUrl({"url": (obj) => {
|
||||||
// Only convert root relative URLs, which CSS-Loader won't process into require().
|
// Only convert root relative URLs, which CSS-Loader won't process into require().
|
||||||
if (!URL.startsWith('/') || URL.startsWith('//')) {
|
if (!obj.url.startsWith('/') || obj.url.startsWith('//')) {
|
||||||
return URL;
|
return obj.url;
|
||||||
}
|
}
|
||||||
if (deployUrl.match(/:\/\//)) {
|
if (deployUrl.match(/:\/\//)) {
|
||||||
// If deployUrl contains a scheme, ignore baseHref use deployUrl as is.
|
// If deployUrl contains a scheme, ignore baseHref use deployUrl as is.
|
||||||
return `${deployUrl.replace(/\/$/, '')}${URL}`;
|
return `${deployUrl.replace(/\/$/, '')}${obj.url}`;
|
||||||
}
|
}
|
||||||
else if (baseHref.match(/:\/\//)) {
|
else if (baseHref.match(/:\/\//)) {
|
||||||
// If baseHref contains a scheme, include it as is.
|
// If baseHref contains a scheme, include it as is.
|
||||||
return baseHref.replace(/\/$/, '') +
|
return baseHref.replace(/\/$/, '') +
|
||||||
`/${deployUrl}/${URL}`.replace(/\/\/+/g, '/');
|
`/${deployUrl}/${obj.url}`.replace(/\/\/+/g, '/');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Join together base-href, deploy-url and the original URL.
|
// Join together base-href, deploy-url and the original URL.
|
||||||
// Also dedupe multiple slashes into single ones.
|
// Also dedupe multiple slashes into single ones.
|
||||||
return `/${baseHref}/${deployUrl}/${URL}`.replace(/\/\/+/g, '/');
|
return `/${baseHref}/${deployUrl}/${obj.url}`.replace(/\/\/+/g, '/');
|
||||||
}
|
}
|
||||||
}})
|
}})
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user