From 949e728923ca4218f10f8d5f39272ed59254051c Mon Sep 17 00:00:00 2001 From: Yin Zhang Date: Tue, 6 Jun 2023 14:37:21 -0700 Subject: [PATCH] Fix sass_binary target build with "npm_sass_library" as external npm sass dependency As we upgraded to angular v14 now, and switched to use @use based angular material sass API, we changed the sass_binary dependency from the [_theming.scss](https://github.com/bazelbuild/rules_sass/issues/98) stylesheet to @angular/material, so updating the dependency accordingly should fix the build error of "Cannot find stylesheet to import - @use '@angular/material' as mat". [stackoverflow discussion](https://stackoverflow.com/questions/70836279/integrate-material-ui-into-angular-bazel-project) PiperOrigin-RevId: 538294719 --- frontend/BUILD | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/BUILD b/frontend/BUILD index da840f2bb..fe0f744a7 100644 --- a/frontend/BUILD +++ b/frontend/BUILD @@ -1,5 +1,5 @@ load("@npm//@bazel/rollup:index.bzl", "rollup_bundle") -load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library") +load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "npm_sass_library") load("//defs:defs.bzl", "xprof_ng_module") package(default_visibility = [ @@ -63,11 +63,9 @@ rollup_bundle( ], ) -sass_library( - name = "angular_material_theming", - srcs = [ - "@npm//@angular/material" - ], +npm_sass_library( + name = "angular_material_sass_deps", + deps = ["@npm//@angular/material"], ) sass_binary( @@ -78,11 +76,12 @@ sass_binary( # need to include the node_modules path to enable sass to find the theming file include_paths = [ "node_modules", + "external/npm/node_modules", ], output_name = "styles.css", sourcemap = False, deps = [ - ":angular_material_theming", + ":angular_material_sass_deps", ], )