npm run webpack -- -w not watching

Viewed 2812

If I install webpack globally, then I can run

webpack -w

and it works fine, and continues running, watching my files. If I try to run it locally with

package.json

"scripts": {
    "webpack": "webpack"
}

cmd

npm run webpack -- -w

Then it runs, but it does not watch the files. It completes and return to input on cmd in windows.

Edit:

If I put the -w directly in my package.json then it will watch correctly, but I want the watch to be optional

"scripts": {
    "webpack": "webpack -w"
}
2 Answers
Related