diff --git a/MODULE.bazel b/MODULE.bazel index 432c594bc0..995dd82446 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -17,4 +17,22 @@ node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node") node.toolchain(name = "nodejs") use_repo(node, "nodejs_toolchains") -register_toolchains("@nodejs_toolchains//:all") +# Toolchain registration under bzlmod should match the order of WORKSPACE registration +# which is the order specified in the PLATFORMS dict https://github.com/bazelbuild/rules_nodejs/blob/4c373209b058d46f2a5f9ab9f8abf11b161ae459/nodejs/private/nodejs_toolchains_repo.bzl#L20. +# For each platform, `:_toolchain_target` should be registered before `:_toolchain`, +# https://github.com/bazelbuild/rules_nodejs/blob/4c373209b058d46f2a5f9ab9f8abf11b161ae459/nodejs/repositories.bzl#L461/. +# See https://github.com/bazelbuild/bazel/issues/19645 and https://github.com/bazelbuild/rules_nodejs/pull/3750 for more context. +register_toolchains("@nodejs_toolchains//:linux_amd64_toolchain_target") +register_toolchains("@nodejs_toolchains//:linux_amd64_toolchain") +register_toolchains("@nodejs_toolchains//:linux_arm64_toolchain_target") +register_toolchains("@nodejs_toolchains//:linux_arm64_toolchain") +register_toolchains("@nodejs_toolchains//:linux_s390x_toolchain_target") +register_toolchains("@nodejs_toolchains//:linux_s390x_toolchain") +register_toolchains("@nodejs_toolchains//:linux_ppc64le_toolchain_target") +register_toolchains("@nodejs_toolchains//:linux_ppc64le_toolchain") +register_toolchains("@nodejs_toolchains//:darwin_amd64_toolchain_target") +register_toolchains("@nodejs_toolchains//:darwin_amd64_toolchain") +register_toolchains("@nodejs_toolchains//:darwin_arm64_toolchain_target") +register_toolchains("@nodejs_toolchains//:darwin_arm64_toolchain") +register_toolchains("@nodejs_toolchains//:windows_amd64_toolchain_target") +register_toolchains("@nodejs_toolchains//:windows_amd64_toolchain")