From 35151ea0ca15aa378b2a37be2fbf72cbfe176168 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Tue, 29 Nov 2022 15:41:22 +0000 Subject: [PATCH] build: hide `--loader` warning when ESM import patch is installed (#48282) Similar to the Rules NodeJS require patch, we have an ESM import patch as of the AIO Bazel migration (to support ESM scripts better). This script uses `--loader`, an experimental NodeJS flag. This is similar to how `ts-node` uses it. We should disable the warnings as it results in a lot of unreadable Bazel output and the warnings are okay to be ignored. Note that we cannot fine-grain disable the specific warning so all others would be disabled too. Realistically we haven't seen any in the past and long-term we will be not relying on patched resolution anyway (looking at `rules_js`). PR Close #48282 --- tools/defaults.bzl | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 80ae90a6839..6775e610219 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -413,6 +413,7 @@ def _apply_esm_import_patch(env, templated_args, data): env = dict(env, **{"NODE_MODULES_WORKSPACE_NAME": _node_modules_workspace_name()}) templated_args = templated_args + [ "--node_options=--loader=file:///$$(rlocation $(rootpath //tools/esm-loader:esm-loader.mjs))", + "--node_options=--no-warnings", # `--loader` is an experimental feature with warnings. ] data = data + [ "//tools/esm-loader",