-
-
Notifications
You must be signed in to change notification settings - Fork 301
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
Add .cjs file ending for config file locations #596
Conversation
Did you look into fixing that? I would prefer to properly fix this instead of adding support for |
If I don't misunderstand something here, this is a node.js "issue", not an np issue. It's not even an issue though,. With https://github.com/sindresorhus/np/blob/main/source/config.js So yeah, theoretically we could "fix" all this by using something else than cosmiconfig and moving to an ES module format for this whole project. But that would just move the problem to another place in the project in an unnecessary complicated way. Just adding .cjs support seemed like an easier and non-breaking fix to me. The default for I know all this doesn't seem "proper", un-simple and a little hacky, but in my (and Node.js') mind, using |
This is exactly why I was against using |
Merging, since you're are right, this is the only feasible workaround for now. |
Thanks! Yeah, I feel you. I currently have to use cjs for ALL my config files, babel to eslint to idk what else, because it always breaks somehow if I want to use pure ESM for all of it. Which is a shame obviously, and I absolutely support np going ESM! |
cjs np config files are supported now! sindresorhus/np#596
Maybe I'm missing something, but I can't get .np-config.js files to work in a folder with
type: module
in the package.json. This should fix that issue and also isn't inferring with anything else here AFAIK.I also thought about adding the possibility for .mjs config files, for users without
type: module
but which want to write their config file in es module syntax. But that can also be in a seperate pull request and I wanted to keep it simple for now.