title: babel-node fails to require jsx file in node_modules
body: <p>I know <code>babel-node</code> ignores <code>node_modules</code> by default, so I ran it three different ways to override it, all failed:</p>
  
  <ol>
  <li><p>ran <code>babel-node app.js</code> with <code>.babelrc</code>:</p>
  
  <pre><code>{
    "presets": ["es2015", "react"],
    "only": [
      "app",
      "node_modules/react-components"
    ]
  }
  </code></pre>
  
  <p>result: <code>SyntaxError: Unexpected token &lt;</code> for the required jsx node module</p></li>
  <li><p>ran <code>babel-node app.js</code> with <code>.babelrc</code>:</p>
  
  <pre><code>{
    "presets": ["es2015", "react"],
    "ignore": "node_modules\/(?!react-components)"
  }
  </code></pre>
  
  <p>result: <code>SyntaxError: Unexpected token &lt;</code> for the require jsx node module</p></li>
  <li><p>ran <code>babel-node ./bin/www --ignore '/node_modules/(?!react-components)</code> with <code>.babelrc</code>:</p>
  
  <pre><code>{
    "presets": ["es2015", "react"]
  }
  </code></pre>
  
  <p>result:</p>
  
  <pre><code>[project]/node_modules/babel-preset-react/node_modules/babel-plugin-transform-react-jsx/lib/index.js:12
      var visitor = require("babel-helper-builder-react-jsx")({
                                                             ^
  
  TypeError: object is not a function
  </code></pre></li>
  </ol>
  
  <hr>
  
  <p>Using the register hook with the ignore option worked correctly.</p>
  
  <p>ran <code>node app.js</code> with this code in the beginning of <code>app.js</code></p>
  
  <pre><code>require('babel-core/register')({
      ignore: /node_modules\/(?!react-components)/
  });
  </code></pre>
  
  <p>Even though this works, I still want to know why my implementations with <code>babel-node</code> does not work. Thanks.</p>
  
  <hr>
  
  <p>references:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/31447120/how-do-i-use-babel-in-a-node-cli-program">How do I use babel in a node CLI program?</a></li>
  <li><a href="https://stackoverflow.com/questions/31822593/import-a-module-from-node-modules-with-babel-but-failed">import a module from node_modules with babel but failed</a></li>
  <li><a href="http://babeljs.io/docs/usage/cli/" rel="nofollow noreferrer">http://babeljs.io/docs/usage/cli/</a></li>
  <li><a href="http://babeljs.io/docs/usage/options/" rel="nofollow noreferrer">http://babeljs.io/docs/usage/options/</a></li>
  </ul>