-
Notifications
You must be signed in to change notification settings - Fork 239
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
[RRFC] Add type
to npm init
#347
Comments
Just wanted to share there has been some initial discussion happening here if that is worth carrying over to this RFC - #75 |
I’m not convinced this is actually helpful. In practice, tutorials have blindly recommended using type:module, and users who follow this advice invariably run into hours of debugging confusion until they realize either to remove it, or, until they learn all the caveats involved. This is worsened because most ecosystem tooling is not yet able to handle type:module fully. There hopefully will be a time in the medium term where this is addressed, and perhaps the confusion factor would be addressed by that as well, but at the moment my experience helping newcomers tells me that the best thing for now is to avoid type:module (unless one is an expert). Adding type:commonjs seems like it’d be fine, but if that includes a prompt, then it will be very difficult to concisely convey all the caveats and nuances of the choice, and users are highly likely to find themselves in the same boat i mentioned above. |
Just following up here, the general consensus seems to be to leave the base template of Here's some references to our last few meeting notes:
Going to close based on the above |
How about: |
I understand not wanting to change defaults, but could we at least get the ability to set |
Motivation ("The Why")
The
type
field is used by many folks to be explicit about the how Node.js interprets the.js
extension. It would be great if we could set this field by default, likely tocommonjs
and give folks the ability to overwrite the default withmodule
(or any other future module type)Example
How
Current Behaviour
Currently this is the default output of
npm init --yes
Desired Behaviour
References
https://nodejs.org/dist/latest-v14.x/docs/api/packages.html#packages_type
The text was updated successfully, but these errors were encountered: