From ae9a92d193b9d79a21bb74a1abc5f7461c6e84f5 Mon Sep 17 00:00:00 2001 From: Philippe L'ATTENTION Date: Sat, 21 Dec 2024 22:00:30 +0100 Subject: [PATCH] fix(@react-router/dev): prevent argv parsing crash when optionnal args are passed to the cli (#12609) --- contributors.yml | 1 + packages/react-router-dev/bin.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index f42e82268a..201a75f7ac 100644 --- a/contributors.yml +++ b/contributors.yml @@ -233,6 +233,7 @@ - pavsoldatov - pcattori - petersendidit +- phildl - pierophp - printfn - promet99 diff --git a/packages/react-router-dev/bin.js b/packages/react-router-dev/bin.js index 8886601064..0373bf96f7 100755 --- a/packages/react-router-dev/bin.js +++ b/packages/react-router-dev/bin.js @@ -5,7 +5,7 @@ let arg = require("arg"); // default `NODE_ENV` so React loads the proper version in it's CJS entry script. // We have to do this before importing `run.ts` since that is what imports // `react` (indirectly via `react-router`) -let args = arg({}, { argv: process.argv.slice(2) }); +let args = arg({}, { argv: process.argv.slice(2), stopAtPositional: true }); if (args._[0] === "dev") { process.env.NODE_ENV = process.env.NODE_ENV ?? "development"; } else {