Search code examples
strapi

Strapi watchIgnoreFiles


My server always restarting when I edit an file in my project but I want to exclude the logs directory.

I've tried to use watchIgnoreFiles in my server.js but it doesn't work.

Can you help me thanks

folders tree

server.js


Solution

  • If you're using Strapi v4 you need to move your watchIgnoreFiles setting from server.js to admin.js. To exclude the whole logs folder use this example:

    module.exports = ({ env }) => ({
      // some other variables are here
      watchIgnoreFiles: [
        '**/logs',
        './logs'
      ]
    });
    

    This forum thread may help as well: https://forum.strapi.io/t/change-file-without-triggering-a-reload-of-strapi/4026/7