diff --git a/packages/angular_devkit/build_angular/src/builders/browser-esbuild/css-resource-plugin.ts b/packages/angular_devkit/build_angular/src/builders/browser-esbuild/css-resource-plugin.ts index 0445c0fd776f..5cdad4e52e15 100644 --- a/packages/angular_devkit/build_angular/src/builders/browser-esbuild/css-resource-plugin.ts +++ b/packages/angular_devkit/build_angular/src/builders/browser-esbuild/css-resource-plugin.ts @@ -34,6 +34,15 @@ export function createCssResourcePlugin(): Plugin { return null; } + // If root-relative, absolute or protocol relative url, mark as external to leave the + // path/URL in place. + if (/^((?:\w+:)?\/\/|data:|chrome:|#|\/)/.test(args.path)) { + return { + path: args.path, + external: true, + }; + } + const { importer, kind, resolveDir, namespace, pluginData = {} } = args; pluginData[CSS_RESOURCE_RESOLUTION] = true;