Search code examples
javascriptnode.jspm2

PM2: ignore watch folder glob pattern


I want pm2 to stop watching folders which have a name like cache or tmp.

I tried a lot of manners in my app.json config file :

{"apps": [{
    "name": "BSTAT",
    "script": "./server/app.js",
    "watch": true,
    "ignore_watch": [
        "HERE IS WHAT I HAVE TRIED ==>",
        "*cache*",
        "*/cache",
        "cache/",
        "*cache/*"
    ],
}]}

and also saw this question who doesn't seem to have an exemple of that case.

The only way that I find to resolve the problem was to put the exact path like server/my-module/cache

I can not bring myself to think this is not possible...that's why I request your help :)


Solution

  • You need a glob pattern for this, e.g.:

    ignore_watch : ['./**/*tests.js'] 
    

    this pattern will ignore all files with name "tests.js" in all sub-folders of the project.