Skip to content

Commit 13f7c54

Browse files
devversionjelbourn
authored andcommitted
build: patch rules_sass to properly report errors in worker mode (#18248)
1 parent 797b0fc commit 13f7c54

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

WORKSPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ http_archive(
1515
# Add sass rules
1616
http_archive(
1717
name = "io_bazel_rules_sass",
18+
# Patch `rules_sass` to work around a bug that causes error messages to be not
19+
# printed in worker mode: https://github.com/bazelbuild/rules_sass/issues/96.
20+
# TODO(devversion): remove this patch once the Sass Node entry-point returns a `Promise`.
21+
patches = ["//tools/bazel:sass_worker_async.patch"],
1822
sha256 = "c78be58f5e0a29a04686b628cf54faaee0094322ae0ac99da5a8a8afca59a647",
1923
strip_prefix = "rules_sass-1.25.0",
2024
urls = [
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git sass/sass_wrapper.js sass/sass_wrapper.js
2+
index 21abb8f..168ee49 100644
3+
--- sass/sass_wrapper.js
4+
+++ sass/sass_wrapper.js
5+
@@ -17,7 +17,9 @@ const fs = require('fs');
6+
const args = process.argv.slice(2);
7+
if (runAsWorker(args)) {
8+
debug('Starting Sass compiler persistent worker...');
9+
- runWorkerLoop(args => sass.run_(args));
10+
+ runWorkerLoop(args => {
11+
+ return new Promise((resolve, reject) => sass.run_(args)['then$1$2$onError'](resolve, reject));
12+
+ });
13+
// Note: intentionally don't process.exit() here, because runWorkerLoop
14+
// is waiting for async callbacks from node.
15+
} else {

0 commit comments

Comments
 (0)