Skip to content

Commit 7c87ce4

Browse files
clydinangular-robot[bot]
authored andcommittedJan 3, 2023
fix(@angular-devkit/build-angular): ensure Sass load paths are resolved from workspace root
When using the esbuild-based browser application builder, the Sass compiler will attempt to resolve any relative load paths from the current working directory. However, the load paths from the `angular.json` file should always be relative to the location of the `angular.json` which is considered the workspace root. While the current working directory is typically also the workspace root, it is not required nor always the same. To resolve this potential mismatch, the load paths are now resolved from the workspace root prior to being passed to the Sass compiler.
1 parent e91734f commit 7c87ce4

File tree

1 file changed

+4
-1
lines changed
  • packages/angular_devkit/build_angular/src/builders/browser-esbuild

1 file changed

+4
-1
lines changed
 

‎packages/angular_devkit/build_angular/src/builders/browser-esbuild/stylesheets.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ export function createStylesheetBundleOptions(
4747
plugins: [
4848
createSassPlugin({
4949
sourcemap: !!options.sourcemap,
50-
loadPaths: options.includePaths,
50+
// Ensure Sass load paths are absolute based on the workspace root
51+
loadPaths: options.includePaths?.map((includePath) =>
52+
path.resolve(options.workspaceRoot, includePath),
53+
),
5154
inlineComponentData,
5255
}),
5356
createCssResourcePlugin(),

0 commit comments

Comments
 (0)
Please sign in to comment.