-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
Make input file extensions configurable via .babelrc/API (T6673) #3741
Comments
Could you clarify what you mean? Extensions for what? Some solid examples would be useful. |
Sure. The default value for extensions value is |
Are you open to PR's for this? |
I think we'd like to move less options into babelrc in general? Do you have any particular use case that would require this? |
Interesting. In this case, LightScript, which operates as a babel plugin, uses the If An alternative would be to allow the plugin itself to specify extensions, but a quick glance at the code indicates that might be tricky in some cases. For example, babel-register, babel-cli, etc, would need to check with plugins at boot time, essentially. |
As someone using |
There are a few issues I see with this. I think the biggest one is just that we don't control the callsites of most Babel usecases. A standard Webpack usecase is
Maybe a better compromise would be to allow a
to limit it to only compiling the files you care about? |
Interesting. It's currently much easier to use webpack than babel itself for this kind of use-case, because of what you mentioned. Most webpack users are used to being explicit about file extensions, so I'm not personally worried about duplicate code in the user's configs there. The bigger problem occurs when config leaks out of config files. If a project can't build without special flags, that's unfortunate (assuming a config file is available).
If All that being said, the proposed compromise doesn't seem like enough of a win to justify its addition (though I appreciate it!). Chances are, in this case, I'll create a lightscript-specific cli that shims |
Another use case is typescript. When using a build flow like The other option is to use a flow like It'd be great if I were able to instead have this config in my My personal opinion is that if you're able to configure it from the CLI, you should be able to add it to |
Closing in favor of #8652 |
Bug information
Description
I'd like to be able to declare my "extensions" inside my
.babelrc
file so that anyone running babel-cli in the project directory will get the same "extensions" option I chose. As I understand, this would mean extending the general options for babel to use extensions, rather than baking that into the babel-cli module. I think this makes sense because the extensions in which the code is authored is more a concern at the project level than a concern that someone could have regarding where input comes from and where output goes to (such as the current babel-cli options).The text was updated successfully, but these errors were encountered: