From 5c8ffd80584bc1b931a663d56d511755b69ce5b5 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) --- .changeset/pretty-clouds-cough.md | 5 +++++ contributors.yml | 1 + packages/react-router-dev/bin.js | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/pretty-clouds-cough.md diff --git a/.changeset/pretty-clouds-cough.md b/.changeset/pretty-clouds-cough.md new file mode 100644 index 0000000000..996e5ff46f --- /dev/null +++ b/.changeset/pretty-clouds-cough.md @@ -0,0 +1,5 @@ +--- +"@react-router/dev": patch +--- + +Fix for a crash when optional args are passed to the CLI 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 {