diff --git a/meteor b/meteor index c335c922c0..cda924cbf0 100755 --- a/meteor +++ b/meteor @@ -123,7 +123,7 @@ fi DEV_BUNDLE="$SCRIPT_DIR/dev_bundle" METEOR="$SCRIPT_DIR/tools/index.js" -PROCESS_REQUIRES="$SCRIPT_DIR/tools/node-process-requires.js" +PROCESS_REQUIRES="$SCRIPT_DIR/tools/node-process-warnings.js" # Set the nofile ulimit as high as permitted by the hard-limit/kernel if [ "$(ulimit -Sn)" != "unlimited" ]; then @@ -138,11 +138,6 @@ if [ "$(ulimit -Sn)" != "unlimited" ]; then fi fi -# By default, we disable all the Node warnings -# Then we re-enable the warning on tools/node-process-warning -# The advantage of this is that we have full control of which warning we want to suppress -export NODE_OPTIONS="--no-warnings $NODE_OPTIONS" - # We used to set $NODE_PATH here to include the node_modules from the dev # bundle, but now we just get them from the symlink at tools/node_modules. This # is better because node_modules directories found via the ancestor walk from @@ -154,5 +149,6 @@ export NODE_OPTIONS="--no-warnings $NODE_OPTIONS" exec "$DEV_BUNDLE/bin/node" \ --max-old-space-size=4096 \ --no-wasm-code-gc \ + --require="$PROCESS_REQUIRES"\ ${TOOL_NODE_FLAGS} \ "$METEOR" "$@" diff --git a/meteor.bat b/meteor.bat index aa6b05d750..1f0f75d081 100644 --- a/meteor.bat +++ b/meteor.bat @@ -48,6 +48,7 @@ SET BABEL_CACHE_DIR=%~dp0\.babel-cache "%~dp0\dev_bundle\bin\node.exe" ^ --no-wasm-code-gc ^ + --require="%~dp0\tools\node-process-warnings.js" ^ %TOOL_NODE_FLAGS% ^ "%~dp0\tools\index.js" %* diff --git a/tools/index.js b/tools/index.js index 5967be9ed7..82876cae67 100644 --- a/tools/index.js +++ b/tools/index.js @@ -1,4 +1,3 @@ -require("./node-process-warnings"); const { getChildProcess } = require("./cli/dev-bundle-bin-commands"); getChildProcess({ isFirstTry: true }).then( diff --git a/tools/node-process-warnings.js b/tools/node-process-warnings.js index a96bee9d5b..9dbc7919dd 100644 --- a/tools/node-process-warnings.js +++ b/tools/node-process-warnings.js @@ -1,20 +1,22 @@ -process.on("warning", (warn) => { - if (warn.message.includes("punycode")) { - /* - * A warning was introduced in Node 22: - * - * "The `punycode` module is deprecated. Please use a userland alternative instead." - * - * The problem is that punycode is deeply integrated in the Node system. It's not a - * simple direct dependency. - * - * Check these issues for more details: - * https://github.com/mathiasbynens/punycode.js/issues/137 - * https://stackoverflow.com/questions/68774489/punycode-is-deprecated-in-npm-what-should-i-replace-it-with/78946745 - * - * This warning was, besides being annoying, breaking our tests. - */ +const originalEmitWarning = process.emitWarning; + +process.emitWarning = function (message) { + /* + * A warning was introduced in Node 22: + * + * "The `punycode` module is deprecated. Please use a userland alternative instead." + * + * The problem is that punycode is deeply integrated in the Node system. It's not a + * simple direct dependency. + * + * Check these issues for more details: + * https://github.com/mathiasbynens/punycode.js/issues/137 + * https://stackoverflow.com/questions/68774489/punycode-is-deprecated-in-npm-what-should-i-replace-it-with/78946745 + * + * This warning was, besides being annoying, breaking our tests. + */ + if (message.includes("punycode")) { return; } - console.warn(warn); -}); + return originalEmitWarning(message); +};