Skip to content

Commit 4cb27b8

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular-devkit/build-angular): avoid attempted resolve of external CSS URLs with esbuild builder
When using the experimental esbuild-based browser application builder, `url()` functions within stylesheets will no longer cause a build failure due to an attempted local file resolution of URLs that do not represent on-disk resources. This includes absolute, protocol-relative, and root-relative URLs as well as SVG path identifiers. (cherry picked from commit 932a4f4)
1 parent 24770f4 commit 4cb27b8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/angular_devkit/build_angular/src/builders/browser-esbuild/css-resource-plugin.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ export function createCssResourcePlugin(): Plugin {
3434
return null;
3535
}
3636

37+
// If root-relative, absolute or protocol relative url, mark as external to leave the
38+
// path/URL in place.
39+
if (/^((?:\w+:)?\/\/|data:|chrome:|#|\/)/.test(args.path)) {
40+
return {
41+
path: args.path,
42+
external: true,
43+
};
44+
}
45+
3746
const { importer, kind, resolveDir, namespace, pluginData = {} } = args;
3847
pluginData[CSS_RESOURCE_RESOLUTION] = true;
3948

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy