I have a pretty basic nodemon configuration. I'm fixing this legacy node 7 project that I inherited and trying to make the development process a little bit painful. First thing first, a proper restart-and-transpile process (since it's built using ES6 modules syntax).
This is my folder structure:
- src
|- index.js
- dist
|- index.js
- index.js
- nodemon.js
I run nodemon as "start:dev": "nodemon index.js"
Here's it's content:
// index.js
if (process.env.NODE_ENV === 'production') {
require('./dist/index.js');
} else {
require('babel-register')({});
require('babel-polyfill');
require('./src/index.js');
}
The idea is that the code is transpiled on runtime, so that I don't have to stop server, re-transpile, start server manually, as I have been doing before.
Last but not least, nodemon config
// nodemon.js
{
"restartable": "rs",
"ignore": [
".git",
"node_modules/**/node_modules"
],
"verbose": true,
"watch": [
"src"
],
"env": {
"NODE_ENV": "development"
},
"ext": "js json"
}
I took this setup from MERN, and I think it should work. However, when I made a change and save, it goes:
[nodemon] files triggering change check: src/index.js
[nodemon] matched rule: /Users/me/project/path/src/**/*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] src/index.js
(stuck here. it never restarts)
I've been checking the code, and the only thing that I'm unfamiliar with, that maybe be causing it I can think of would be a child_process.execFileSync()
call, that will call a java tool; and a connection pool with mysql.createPool()
(mysql
package).
Tried both in Node 7.5 and Node 8.9. Any idea of what could be wrong?