Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): ensure Sass load paths are resolv…
Browse files Browse the repository at this point in the history
…ed 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.
  • Loading branch information
clydin authored and angular-robot[bot] committed Jan 3, 2023
1 parent e91734f commit 7c87ce4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export function createStylesheetBundleOptions(
plugins: [
createSassPlugin({
sourcemap: !!options.sourcemap,
loadPaths: options.includePaths,
// Ensure Sass load paths are absolute based on the workspace root
loadPaths: options.includePaths?.map((includePath) =>
path.resolve(options.workspaceRoot, includePath),
),
inlineComponentData,
}),
createCssResourcePlugin(),
Expand Down

0 comments on commit 7c87ce4

Please sign in to comment.