[bazel] Implement external_include_paths feature (#1723)
diff --git a/bazel/emscripten_toolchain/toolchain.bzl b/bazel/emscripten_toolchain/toolchain.bzl
index aafa0ba..07cadef 100644
--- a/bazel/emscripten_toolchain/toolchain.bzl
+++ b/bazel/emscripten_toolchain/toolchain.bzl
@@ -318,6 +318,7 @@
         # Blaze requests this feature by default.
         # Blaze also tests if this feature is supported before setting includes. (...but why?)
         feature(name = "include_paths"),
+        feature(name = "external_include_paths"),
 
         # Blaze tests if this feature is enabled in order to create implicit
         # "nodeps" .so outputs from cc_library rules.
@@ -752,6 +753,17 @@
             actions = preprocessor_compile_actions,
             flag_groups = [
                 flag_group(
+                    flags = ["-isystem", "%{external_include_paths}"],
+                    iterate_over = "external_include_paths",
+                    expand_if_available = "external_include_paths",
+                ),
+            ],
+            features = ["external_include_paths"],
+        ),
+        flag_set(
+            actions = preprocessor_compile_actions,
+            flag_groups = [
+                flag_group(
                     flags = ["-iquote", "%{quote_include_paths}"],
                     iterate_over = "quote_include_paths",
                 ),