From 7cc8261fd2eb0ef1665faebec43cba447a64fd33 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 23 Feb 2024 09:37:52 -0500 Subject: [PATCH] fix(@angular-devkit/build-angular): avoid implicit CSS file extensions when resolving Unlike the non-ESM Node.js resolution for JS files, CSS does not have the concept of implicit file extensions. To avoid incorrectly resolving a file as CSS, stylesheet bundling no longer attempts to resolve implicit extensions. Preprocessors, such as Sass, contain logic internally that handles any specific resolution cases for their respective preprocessor and such behavior is unaffected. (cherry picked from commit 8d1a7c3f1aa4ac23548b9ae6470d603503cee31f) --- .../src/tools/esbuild/stylesheets/bundle-options.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/angular_devkit/build_angular/src/tools/esbuild/stylesheets/bundle-options.ts b/packages/angular_devkit/build_angular/src/tools/esbuild/stylesheets/bundle-options.ts index ef4355ec78a5..bb52ce4776ec 100644 --- a/packages/angular_devkit/build_angular/src/tools/esbuild/stylesheets/bundle-options.ts +++ b/packages/angular_devkit/build_angular/src/tools/esbuild/stylesheets/bundle-options.ts @@ -84,6 +84,9 @@ export function createStylesheetBundleOptions( publicPath: options.publicPath, conditions: ['style', 'sass', 'less'], mainFields: ['style', 'sass'], + // Unlike JS, CSS does not have implicit file extensions in the general case. + // Preprocessor specific behavior is handled in each stylesheet language plugin. + resolveExtensions: [], plugins, }; }