nodemon
nodemon copied to clipboard
Watch .cjs files by default
"By default, nodemon looks for files with the .js, .mjs, .coffee, .litcoffee, and .json"
This seems like madness! : )
In an ES6 project I often have to use a .cjs file here or there. If nodemon is watching .mjs files by default why not .cjs files?
Not sure why madness. The project was created over 11 years ago.
I've personally never used .cjs (nor .mjs, but I got a PR for support).
I'll leave this open for a while and if there's interest from others via 👍 then we can add it in. Otherwise it's a personal config setting.
Sure, I understand. There's a reason for everything. It just seemed that way looking at it today.
It's a noob of a noob trap as it is. I figured it what it was in about 10 minutes (mixture of .js and .cjs in my project), but I can imagine quite a bit of frustration being caused by it.
I guess there are a host of other extensions that -could- be included. .jsx, .ts and .tsx come to mind.
@RobertSandiford A quick solution would be to add a nodemon.json
config file containing the extensions you want watching:
{"ext": "js mjs cjs json"}
I took that from this sample: https://github.com/remy/nodemon/wiki/Sample-nodemon.json , tested it and seems to be working:
[nodemon] watching extensions: js,mjs,cjs,json
@lorand-horvath or --ext=cjs,js
But just unnecessary to make people do that, hence the thread.
@RobertSandiford Agreed, cjs could be added as default, I don't think it would create any issues. @remy PR added https://github.com/remy/nodemon/pull/1957 Hope I edited the proper location :)
@RobertSandiford @remy It seems strange, but I've just tested the inline option below and it doesn't work with latest nodemon 2.0.15
nodemon --ext="js,mjs,cjs,json" index.js
It returns:
[nodemon] starting 'node --ext=js,mjs,cjs,json index.js'
node: bad option: --ext=js,mjs,cjs,json
Am I missing something?
Space not the =
symbol separates the arguments IIRC
Yes, you are correct
nodemon --ext js,cjs,mjs script
This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3
Am reviewing. Not totally sure about the PR (just to buy a little more time from stale-bot)
Automatically closing this issue due to lack of activity