diff --git a/bazel/BUILD b/bazel/BUILD
index 7a13c92db7..54041921cb 100644
--- a/bazel/BUILD
+++ b/bazel/BUILD
@@ -67,9 +67,15 @@ alias(
     }),
 )
 
+constraint_value(
+    name = "os_emscripten",
+    constraint_setting = "@platforms//os",
+)
+
 platform(
     name = "platform_wasm",
     constraint_values = [
         "@platforms//cpu:wasm32",
+        ":os_emscripten",
     ],
 )
diff --git a/bazel/emscripten_toolchain/BUILD.bazel b/bazel/emscripten_toolchain/BUILD.bazel
index 4486220b56..9ec48f0a8c 100644
--- a/bazel/emscripten_toolchain/BUILD.bazel
+++ b/bazel/emscripten_toolchain/BUILD.bazel
@@ -5,7 +5,7 @@ package(default_visibility = ["//visibility:public"])
 # Name depends on rules_nodejs version being used.
 # https://github.com/emscripten-core/emsdk/issues/1020
 # https://github.com/bazelbuild/rules_nodejs/issues/3375
-node_files = "@nodejs_host//:node_files" if existing_rule("@nodejs_host//:node_files") else "@nodejs//:node_files"
+node_files = "@nodejs_host//:node_files"
 
 filegroup(
     name = "common_files",