callumacrae callumacrae - 7 months ago 46
Node.js Question

Using the babel-register `only` option

I have the following config in my .babelrc:

"presets": ["react", "es2015"],
"only": ["app/**/*.js", "src/**/*.js", "test/**/*.js", "node_modules/my-module/**/*.js"]

I basically want my-module in the node_modules directory to be passed through babel, and so am using the

However, it doesn't seem to be working. Any ES6 I write—whether in my-module or even just app/app.js—isn't transpiled, and so breaks my app.

Any ideas? Am I misunderstanding the documentation?

Previously I was doing the following:

ignore: function (filename) {
if (filename.indexOf('node_modules') === -1) {
return false;

return filename.indexOf('@lostmyname/styleguide') === -1;

However, I need to use the .babelrc because I'm adding mocha, which only supports the require hook with no options.


Apparently this was caused by a bug in babel:

It's been fixed: