Nodemon + babel restart the server multiple times
<p>In my <strong>package.json</strong> I have a start-script which I'm using for my dev enviroment. It looks like this:</p>

<pre><code>"scripts": {
    "dev": "NODE_PATH=src nodemon --watch src/ --exec babel-node src/app.js"
}
</code></pre>

<p>When I'm hitting <code>npm run dev</code> everything works fine and babel is transpiling everything as it should and nodemon starts watching. I see this:</p>

<pre><code>[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: /Users/Jonathan/Documents/swissnet/src/**/*
[nodemon] starting `babel-node src/app.js`
</code></pre>

<p>When I'm saving files within the src/-folder nodemon will restart the server. But here's my issue, It restarts 2-3 times...  Everytime I save a file it looks like this:</p>

<pre><code>[nodemon] restarting due to changes...
[nodemon] starting `babel-node src/app.js`
[nodemon] restarting due to changes...
[nodemon] starting `babel-node src/app.js`
[nodemon] restarting due to changes...
[nodemon] starting `babel-node src/app.js`
</code></pre>

<p>If I enter "rs" then nodemon restarts, once, as expected.</p>

<p>I have no idea how to solve this, or even where to search for answers. I've tried to google it. I've been visiting the bug section of the package on github... (Maybe I just suck at googling).<br>
Here's the only link I've found for the same issue, but it doesn't seem to have an answer: <a href="https://stackoverflow.com/questions/39340268/nodemon-runs-multiple-times-on-save-when-using-babel">Nodemon runs multiple times on save when using babel</a>.<br>
I tried his script anyway <code>NODE_PATH=src nodemon src --exec babel -w src/ --out-dir build/ --source-maps</code> but the same thing happened, restarting twice or thrice.</p>

<p>Like @Connorelsea said in the comment section of the answer provided in the link above, if I add <code>--delay 2.5</code> it restart only once.</p>

<p>I'm thinking maybe when I hit save in a watched file, nodemon restarts instantly and babel start transpiling. When babel is done it saves a bunch om transpiled files and nodemon restarts once again since changes to the src/-folder was made. But I have no idea how to debug this.</p>

<p>Hope you guys can help me!</p>

<p>**** EDIT ****</p>

<p>Just found this <a href="https://github.com/remy/nodemon/issues/508" rel="noreferrer">https://github.com/remy/nodemon/issues/508</a> but the only solutions they have is to "upgrade nodemon". I do have the latest which is  1.11.0 at this time.</p>