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
Better error handling for include
and exclude
options when option is not an array
#11561
Comments
Hey @JMarkoski! 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." |
It's yours! |
@nicolo-ribaudo I found another, somewhat related issue, so my question is whether to open another separate issue (maybe for better documentation of what is fixed) or to fix the problem in this one. The issue is as follows: The docs about include (https://babeljs.io/docs/en/babel-preset-env#include say that plugins prefixed with
EDIT: PR for this issue: babel/website#2250 |
Let's update the docs and keep the regexp as-is. |
@nicolo-ribaudo Should I update the docs in this issue or should I file a separate one? |
Opening a PR in the |
Bug Report
Current Behavior
When setting the
exclude
option on@babel/preset-env
to a string that represents a plugin (with intention to exclude that plugin) babel throws non-descriptive errorMoreover, if we provide anything other than array for the options
exclude
andinclude
, the same error will be thrown, that relates to the way thebabel/packages/babel-preset-env/src/normalize-options.js
Line 78 in 9a52019
Expected behavior/code
The expected behavior is to throw a more descriptive error about invalid options provided and maybe to accept valid strings that map to plugins.
Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)
babel.config.js
Environment
Possible Solution
Normalize and validate the input before checking here:
babel/packages/babel-preset-env/src/normalize-options.js
Line 85 in 9a52019
The text was updated successfully, but these errors were encountered: