Manuel Manuel - 2 years ago 193
Node.js Question

Make babel exclude test files

On my build step I'm using babel to transpile the code to es5 (from

). How do I make it exclude files ending in


"scripts": {
"build": "babel src --out-dir dist",


"presets": [ "es2015" ],
"ignore": "\\.test\\.js"

Answer Source

Based on the documentation, you should be able to write .bablerc

  "ignore": [

However, I was able to verify that this does not seem to work. I tried it with version 6.5.1 (babel-core 6.5.2).

At the same time, the following does work:

babel src --out-dir build --ignore "**/*.test.js"

That is the same glob pattern as written in the .bablerc file. If you install any glob library from npm you'll find that this glob pattern would work (that is how I came up with it...I do not currently use babel).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download