Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch .cjs files by default #1954

Closed
RobertSandiford opened this issue Nov 13, 2021 · 11 comments
Closed

Watch .cjs files by default #1954

RobertSandiford opened this issue Nov 13, 2021 · 11 comments
Labels
stale no activity for 2 weeks

Comments

@RobertSandiford
Copy link

"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?

@remy
Copy link
Owner

remy commented Nov 13, 2021

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.

@RobertSandiford
Copy link
Author

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.

@lorand-horvath
Copy link

@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

@RobertSandiford
Copy link
Author

@lorand-horvath or --ext=cjs,js

But just unnecessary to make people do that, hence the thread.

@lorand-horvath
Copy link

lorand-horvath commented Nov 18, 2021

@RobertSandiford Agreed, cjs could be added as default, I don't think it would create any issues.
@remy PR added #1957 Hope I edited the proper location :)

lorand-horvath added a commit to lorand-horvath/nodemon that referenced this issue Nov 18, 2021
@lorand-horvath
Copy link

@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?

@remy
Copy link
Owner

remy commented Nov 18, 2021

Space not the = symbol separates the arguments IIRC

@RobertSandiford
Copy link
Author

Yes, you are correct
nodemon --ext js,cjs,mjs script

@github-actions
Copy link

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

@github-actions github-actions bot added the stale no activity for 2 weeks label Jun 28, 2022
@remy
Copy link
Owner

remy commented Jul 12, 2022

Am reviewing. Not totally sure about the PR (just to buy a little more time from stale-bot)

@github-actions
Copy link

Automatically closing this issue due to lack of activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity for 2 weeks
Projects
None yet
Development

No branches or pull requests

3 participants