Closed adamborys closed 3 years ago
same problem for me : run npm-watch with this config not working
{
"watch": {
"build": "src/*.jsx"
},
"scripts": {
"start": "node ./scripts/start-non-split.js",
"build": "node ./scripts/build-non-split.js",
"test": "react-scripts test",
"eject": "react-scripts eject",
"watch": "npm-watch"
}
}
It's run build a first time on launch but never re-run build script when saving jsx file...
EDIT : Watch working if i rewrite my package.json like this :
{
"watch": {
"build": {
"patterns": [
"src"
],
"extensions": "jsx"
}
},
"scripts": {
"start": "node ./scripts/start-non-split.js",
"build": "node ./scripts/build-non-split.js",
"test": "react-scripts test",
"eject": "react-scripts eject",
"watch": "npm-watch"
},
}
The issue has to do with the extensions that nodemon watches by default.
So the solution is to use the extended config option with the extensions
option set.
@adamborys This should do what you need:
"watch": {
"push": {
"patterns": "*.{js,html}",
"extensions": "js, html"
},
I run npm-watch in whole project directory with pattern
It works only when saving *.js files
My file tree: └─ main.js └─ variables-dialog.html └─ variables-service.js └─ package.json └─ package-lock.json