Passing arguments to combined npm script

后端 未结 1 2005
我寻月下人不归
我寻月下人不归 2021-01-15 15:36

I have in my package.json the following

\"scripts\": {
    ...
    \"prod\": \"gulp build --production && webpack --env.config=production\"
}
         


        
相关标签:
1条回答
  • 2021-01-15 16:07

    If you're using Bash you can use a function in your npm-script.

    For instance:

    "scripts": {
        ...
        "prod": "func() { gulp build --production \"$1\" && webpack --env.config=production \"$1\"; }; func"
    }
    

    However, for a cross-platform solution you'll need to consider invoking a nodejs script which exec's the commands - in a similar way shown in Solution 2 of my answer here.

    0 讨论(0)
提交回复
热议问题