jeffrifwald/babel-istanbul

Allow passing options to Babel again, please!

thealjey opened this issue · 6 comments

Instrumenter.prototype.instrumentSync has a very handy option babelConfig, which run-with-cover.js is not passing to it.
Simply creating a .babelrc file is not an option for me.

The only thing I do not like about Babel right now is that it does not have a --config option and you cannot set a specific configuration file to use. It's not a problem for projects that are using Babel directly, but it is for a reusable library.

Would you be so kind as to allow passing options to Babel and not rely solely on .babelrc, or at least add a --config option of your own?
Pretty please 😺

Thank you!

I could try to whip up a PR if that's ok with you.

Yeah that'd be great if you want to add a --babel-config option for specifying the babel config.

Just to be clear - --babel-config would be a path to a json file, with the same purpose as .babelrc, but with a benefit that you'll be able to choose which one to use exactly instead of the weird Babel way of searching the file system, right?

Yeah, you'll likely need to read in that json file and pass it to the babel.transform function in the instrumenter. Make sure to override those options to ensure the source map is still going to be generated. The options sourceMaps and filename are the two that babel-istanbul relies on to get its job done.

#39 - the PR is ready for review 🙏

@jmcriffey hi, sorry for bothering))
could you please review #39?