Skip to content

Commit f8ff528

Browse files
zzzariescopybara-github
authored andcommitted
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](bazelbuild/rules_sass#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: 538314806
1 parent 325cf0a commit f8ff528

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

frontend/BUILD

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
2-
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")
2+
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "npm_sass_library")
33
load("//defs:defs.bzl", "xprof_ng_module")
44

55
package(default_visibility = [
@@ -63,11 +63,9 @@ rollup_bundle(
6363
],
6464
)
6565

66-
sass_library(
67-
name = "angular_material_theming",
68-
srcs = [
69-
"@npm//@angular/material"
70-
],
66+
npm_sass_library(
67+
name = "angular_material_sass_deps",
68+
deps = ["@npm//@angular/material"],
7169
)
7270

7371
sass_binary(
@@ -78,11 +76,12 @@ sass_binary(
7876
# need to include the node_modules path to enable sass to find the theming file
7977
include_paths = [
8078
"node_modules",
79+
"external/npm/node_modules",
8180
],
8281
output_name = "styles.css",
8382
sourcemap = False,
8483
deps = [
85-
":angular_material_theming",
84+
":angular_material_sass_deps",
8685
],
8786
)
8887

0 commit comments

Comments
 (0)