How to pass an argument with a leading slash to npm script

Viewed 288

I have a package.json with some scripts:

 "scripts": {
    "build": "webpack-cli --mode production",
    "build:dev": "webpack-cli --mode development",
 }

I just want to pass an additional parameter from the command line and not from the scripts in the package.json, so I run a basic command line like this:

npm run build:dev -- --test /toto/

I would like this command:

webpack-cli --mode development "--test" "/toto/"

But, it runs this command:

webpack-cli --mode development "--test" "C:/Program Files/Git/toto/"

Do you have any idea how could I avoid to have the absolute path in front the string "/toto" ?

1 Answers

Just compose the command with "'/toto/'"

npm run build:dev -- --test "'/toto/'"
Related