You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disallow using passPerPreset in user Babel configurations.
Context
The majority of current usages of passPerPreset in user code originally date to a misunderstanding about plugin ordering with Relay. Relay examples now no longer use passPerPreset: facebookarchive/relay-starter-kit#102, and I've opened an issue with the Apollo devs to remove derived usages there as well: apollographql/starwars-server#5.
Correspondingly, there may not be any real use cases for passPerPreset in user code any more. As such, given that this feature has historically not been used very often, and has led to odd interactions between existing presets due to just using a rare code path (e.g. #4162), I think it would make sense to heavily limit its use.
Even in cases where it does arise, it's not the correct scope – the scope instead looks more like "this preset or this plugin should have its own pass", rather than "every preset or plugin in this config (or every plugin in this preset) should have its own pass".
Hey @taion! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.
You can also see that substantially all those cases are GraphQL-related cases, owing ultimately to that initial Relay thing.
I think @loganfsmyth mentioned that babel-minify still needed it? Ultimately I think passPerPreset is sort of the wrong concept – like I said above, I can see there being a valuable idea in "this preset runs in its own pass", but ultimately I don't think this option should be exposed to end-users like this.
Even for minify, one goal would be to run the entire minify preset after all the earlier presets, no? I feel like there are a couple of different concepts here that are a little bit mixed up:
Activity
babel-bot commentedon Nov 27, 2017
Hey @taion! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.
xtuc commentedon Dec 1, 2017
I agree that we should restrict its usage. After a quick search it seems that some users are relying on it GitHub search even if it's not documented.
We can introduce a warning in Babel 7 and drop it in Babel 8, what do you think?
taion commentedon Dec 1, 2017
You can also see that substantially all those cases are GraphQL-related cases, owing ultimately to that initial Relay thing.
I think @loganfsmyth mentioned that babel-minify still needed it? Ultimately I think
passPerPresetis sort of the wrong concept – like I said above, I can see there being a valuable idea in "this preset runs in its own pass", but ultimately I don't think this option should be exposed to end-users like this.hzoo commentedon Dec 1, 2017
We said we should at least only allow it in a preset (like minify) then end-users wouldn't be able to set it themselves.
taion commentedon Dec 1, 2017
Even for minify, one goal would be to run the entire minify preset after all the earlier presets, no? I feel like there are a couple of different concepts here that are a little bit mixed up: