-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Discussion: Name of the flag for the “ESM by default” mode #49541
Comments
I’ll start: |
|
Maybe I missed some context somewhere, but why do we need another flag separate from |
Because that one only affects |
Not clear why that would be considered a breaking change. If the flag was not supported in anything but those cases previously then this would just be a case of adding additional support, which sounds to me like a minor. 🤔 In any case, it sounds rather unfriendly from a usability perspective to have two different flags that sound like they do the same thing (Because they do! Just in slightly different contexts.) rather than sticking to the one flag we already have that does this. ESM is already confusing enough with all the extra configs and inconsistencies with CJS-derived expectations, we don't need proliferating flags adding to the complications. 😬 |
Well, maybe it wouldn’t be. Currently if you run Perhaps the better question is whether we would still need A simpler way to put it: if |
I think that's a case of "Just because you can doesn't mean you should." Yes, theoretically that may be a case a user may try to do, but is that something we want to actually support? Or should we just have a switch on all cases? Seems to me a lot less confusing to just have a process wide switch of everything from CJS mode to ESM mode. |
No, unless there’s a plausible, reasonable use case. Which there may very well be! That’s my question, can you think of one? |
I would rather not support it until someone asks for it than try to invent some scenario that a user may never actually do. It's a lot easier to add support for something than it is to remove it. We should be very intentional and feedback-driven by things like that. |
Well except that in this case it’s hard to add support for it if we’ve already redefined I think if we want to potentially use Alternatively we create |
I think it's a bit confusing having a stable and an experimental flag with the same name, other than the experimental prefix. Perhaps a new flag with an additional prefix like |
"input" implies stdin, which is why the name was chosen. why not something like |
I guess? Would it be a semver-major change to expand the responsibilities of |
Like I said, I don't feel like expanding support should be considered a major there. It's up to the TSC though. 🤷🏻♂️ |
I asked at today’s TSC meeting and several people thought that expanding the scope of Personally I want to backport this flag as far back as possible, especially to 20.x, so I’d rather pick a new name than overload |
I considered this name, but I’m not sure users will interpret the name “default” the way we do. Especially since we want to change Node’s default module system in the future. The “default” is the value, |
Semantically this is entirely correct in it being a default of a default, but you would usually just say the "default type" is now module. My concern specifically was about users wondering why |
I don’t think of this as any different than the Likewise, |
I think this is a bit counter intuitive, as usually CLI flags have the higher priority – ecosystem packages that offer configuration from |
I understand the reasoning you're making, but it's still not a strong argument to me. We should evaluate the clarity of the name on its own merits not relatively.
|
I think it’s a subjective call and we should see what the majority of people think. Personally I like the brevity of |
If we want something that’s more specific that avoids the confusion around “default,” we could use |
Seems to me expanding the scope of input-type is breaking. But also, as Jordan mentioned, "input" suggests STDIN, so not appropriate. |
@JakobJingleheimer the recent discussion is about |
|
I like the idea of a short flag. What about |
I think that's fine, but first we need to decide what the name of the long flag should be. Are you saying you prefer |
I don't really have a preference. If there is a short version, it wouldn't matter to me. |
Once the I also value the shortness, which is why I was leaning toward |
To reiterate my concern about the name here - having a flag that does not do what it sounds like it does is a recipe for user confusion. If I see a flag called Therefore my request is that we use any name other than Since this is now blocking #49869, and @GeoffreyBooth is unable to change the PR without consensus, I would like to ask those participating here to urgently help in finding consensus on a suitable name. Those who have already voted for And if anyone has strong opinions for or against here please do share, since not knowing which alternatives are viable is hindering progress currently. |
I added an emoji vote to the top post: #49541 (comment). Please vote so that it’s clear what option(s) you support. I’m happy to go with whatever gets the majority, and I would ask that everyone respect the will of the majority and not block if your preference isn’t chosen. |
Can this be just a boolean? |
FWIW I would encourage anyone who feels strongly against a proposal to speak their mind, no matter if it's the choice of the majority, and block the PR accordingly if necessary. As long as you provide reasonable arguments against a proposition, the project should not move forward with it until the objection is resolved.
If we are serious about flipping the default in the future, we should probably use |
I got that, thanks ;) I was merely omitting the
If a collaborator really feels like extra verbiage is needed to re-assert established behaviour, sure. For probably a majority of usage, it'll be a set-and-forget in some config file, so no need to lose sleep over it—I think all the proposed options convey what they'd do. If there needs to be a tie-breaker (it looks close), my ranked vote is:
|
Now that The inverse would be
We could also just forgo having a short flag for the “back to CommonJS default” option. |
Shipping a short flag for an experimental flag sounds like a mistake, the whole purpose of putting |
Well if we think we want short flags in 22, and if we want |
Can't we just switch to another shorthand instead of deprecating |
We also don't necessarily need to come up with a short flag for commonjs |
I’d dispute that; I’ll forever want to keep my default type as it is, commonjs. |
I don’t think we’re trying to discourage users from using this flag, in fact the opposite. We’re just trying to emphasize to users that it’s subject to changes. The appeal of But if we don’t ship So anyway I think either we deprecate |
I think changing an existing flag is pretty annoying for people. I’d prefer if we do not want to do that. |
Building off of #49432, what should the flag be named for this proposed new mode? Yes, this is the bikeshed thread.
I think we have a few constraints:
--experimental
(for now, until it goes stable).--input-type=module
/--input-type=commonjs
; or have an obvious opposite, so that if/when this new mode becomes the new Node default there’s some way to opt back into the previous CommonJS-first behavior.module
andcommonjs
for consistency with the existing--input-type
and thepackage.json
"type"
field.--experimental-module
because there was a prior flag named--experimental-modules
which still exists as a noop, and it would be confusing to users if nothing happens when they try to use the flag but made a typo.Please vote using emoji:
--experimental-type=module
/--experimental-type=commonjs
--experimental-default-type=module
/--experimental-default-type=commonjs
--experimental-implicit-type=module
/--experimental-implicit-type=commonjs
--experimental-esm-by-default
/--no-experimental-esm-by-default
The text was updated successfully, but these errors were encountered: