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

warn on conflicts between babelrc/babel.config.js and --runtimeflags #8681

Open
Pomax opened this Issue Sep 11, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@Pomax

Pomax commented Sep 11, 2018

I had a .babelrc set up with a JSX transform pragma instruction, but had an npm script that called babel --plugins transform-react-jsx input.js > output.js, and the runtime flag won, so my code kept using React.createElement instead of the pragma I was telling it to us, and nothing warned me that babel had no way to tell which of the runtime flag and the .babelrc jsx options was supposed to win.

Can babel be made to warn the user that they've specified conflicting instructions, or at the very least make it say "possible conflict between runtime and config for plugin blah, using runtime options only"?

@babel-bot

This comment has been minimized.

Show comment
Hide comment
@babel-bot

babel-bot Sep 11, 2018

Collaborator

Hey @Pomax! 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.

Collaborator

babel-bot commented Sep 11, 2018

Hey @Pomax! 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.

@loganfsmyth

This comment has been minimized.

Show comment
Hide comment
@loganfsmyth

loganfsmyth Sep 12, 2018

Member

This is a tough one. Technically this is expected behavior, because configuration values provided at the CLI override configuration in config files by design, the same way plugins in env or overrides blocks override configuration in the top-level file options.

We've talked about having a CLI tool to display your current config and why, which might go a ways toward helping troubleshoot issues like this, though.

Member

loganfsmyth commented Sep 12, 2018

This is a tough one. Technically this is expected behavior, because configuration values provided at the CLI override configuration in config files by design, the same way plugins in env or overrides blocks override configuration in the top-level file options.

We've talked about having a CLI tool to display your current config and why, which might go a ways toward helping troubleshoot issues like this, though.

@Pomax

This comment has been minimized.

Show comment
Hide comment
@Pomax

Pomax Sep 12, 2018

Basically having any indication that overrides are happening would be super. Right now you can get stuck in a situation where you're new to babel, or even just new to babel-cli, and it simply never occurs to you that the cli flag "wins" rather than override. A config that says "use transform-react-jsx with pragma h" and a runtime flag --plugins transform-react-jsx to someone who isn't super familiar with babel would mean the config and runtime flags are complementary: they both load transform-react-jsx, and then the config also says which pragma to use so everything should work just fine.

Then it doesn't =)

Pomax commented Sep 12, 2018

Basically having any indication that overrides are happening would be super. Right now you can get stuck in a situation where you're new to babel, or even just new to babel-cli, and it simply never occurs to you that the cli flag "wins" rather than override. A config that says "use transform-react-jsx with pragma h" and a runtime flag --plugins transform-react-jsx to someone who isn't super familiar with babel would mean the config and runtime flags are complementary: they both load transform-react-jsx, and then the config also says which pragma to use so everything should work just fine.

Then it doesn't =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment