Skip to content
the poor coder

nodemon ignore

Poor Man
Published
Reading time
2 min read
On this page

Understanding nodemon ignore#

If you are a developer who works with Node.js and JavaScript, you have likely encountered the term nodemon ignore. This refers to a feature in nodemon, a popular tool that automatically restarts your Node.js application when changes are made.

What is nodemon ignore?#

Nodemon ignore is a feature that allows you to specify files and directories that nodemon should ignore when watching for changes. This can be useful if you have files in your project that do not need to be monitored for changes, or that could cause issues if they were included in the monitoring process.

How to use nodemon ignore:#

To use nodemon ignore, you simply need to create a nodemon.json file in the root of your project, and add an ignore property to it. For example:

Text
{
  "ignore": [
    "node_modules/",
    "public/"
  ]
}

In this example, nodemon is instructed to ignore the node_modules/ and public/ directories. Any changes made to files within these directories will not trigger a restart of the application.

You can also specify specific files to ignore:

Text
{
  "ignore": [
    "node_modules/",
    "public/",
    "README.md",
    "LICENSE"
  ]
}

In this example, nodemon will ignore the node_modules/, public/, README.md, and LICENSE files.

Multiple ways to use nodemon ignore:#

While creating a nodemon.json file is the most common way to use nodemon ignore, there are other ways to achieve the same result. For example, you can specify the ignore property directly in your package.json file:

Text
{
  "name": "my-project",
  "version": "1.0.0",
  "scripts": {
    "start": "nodemon index.js",
    "dev": "nodemon index.js",
    "test": "jest"
  },
  "nodemonConfig": {
    "ignore": [
      "node_modules/",
      "public/"
    ]
  }
}

In this example, the ignore property is specified in the nodemonConfig property of the package.json file. This achieves the same result as creating a separate nodemon.json file.

Conclusion:#

Nodemon ignore is a useful feature that allows you to specify files and directories that nodemon should ignore when watching for changes. This can be useful if you have files in your project that do not need to be monitored for changes, or that could cause issues if they were included in the monitoring process. There are multiple ways to use nodemon ignore, including creating a separate nodemon.json file, or specifying the ignore property directly in your package.json file.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC