diff --git a/WORKSPACE b/WORKSPACE index e27ecf789640..af4ff7fff2d9 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -15,6 +15,10 @@ http_archive( # Add sass rules http_archive( name = "io_bazel_rules_sass", + # Patch `rules_sass` to work around a bug that causes error messages to be not + # printed in worker mode: https://github.com/bazelbuild/rules_sass/issues/96. + # TODO(devversion): remove this patch once the Sass Node entry-point returns a `Promise`. + patches = ["//tools/bazel:sass_worker_async.patch"], sha256 = "c78be58f5e0a29a04686b628cf54faaee0094322ae0ac99da5a8a8afca59a647", strip_prefix = "rules_sass-1.25.0", urls = [ diff --git a/tools/bazel/sass_worker_async.patch b/tools/bazel/sass_worker_async.patch new file mode 100644 index 000000000000..09562ba2ee63 --- /dev/null +++ b/tools/bazel/sass_worker_async.patch @@ -0,0 +1,15 @@ +diff --git sass/sass_wrapper.js sass/sass_wrapper.js +index 21abb8f..168ee49 100644 +--- sass/sass_wrapper.js ++++ sass/sass_wrapper.js +@@ -17,7 +17,9 @@ const fs = require('fs'); + const args = process.argv.slice(2); + if (runAsWorker(args)) { + debug('Starting Sass compiler persistent worker...'); +- runWorkerLoop(args => sass.run_(args)); ++ runWorkerLoop(args => { ++ return new Promise((resolve, reject) => sass.run_(args)['then$1$2$onError'](resolve, reject)); ++ }); + // Note: intentionally don't process.exit() here, because runWorkerLoop + // is waiting for async callbacks from node. + } else {