title: require is not defined error with Babel file watcher in WebStorm/PhpStorm
body: <p>I have been following this <a href="https://blog.jetbrains.com/webstorm/2015/05/ecmascript-6-in-webstorm-transpiling/" rel="nofollow">guide</a> to transpile ES6 code into ES5 code in PhpStorm.</p>
  
  <p>My problem is that when the script has an import statement:</p>
  
  <pre><code>import TestingView from 'component/TestingView';
  class ItemPage extends React.Component {
      render () {
          return &lt;TestingView&gt;
      }
  }
  </code></pre>
  
  <p>TestingView.js</p>
  
  <pre><code>export default class TestingView extends React.Component{
      render(){
          return &lt;div&gt;Hello!!!!&lt;/div&gt;
      }
  }
  </code></pre>
  
  <p>The file watcher transpile it into the form of:</p>
  
  <pre><code>'use strict';
  
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i &lt; props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  
  var _TestingView = require('component/TestingView');
  
  var _TestingView2 = _interopRequireDefault(_TestingView);
  
  function _interopRequireDefault(obj) { return obj &amp;&amp; obj.__esModule ? obj : { default: obj }; }
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call &amp;&amp; (typeof call === "object" || typeof call === "function") ? call : self; }
  
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" &amp;&amp; superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass &amp;&amp; superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  * Created by laukaichung on 7/10/16.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  */
  
  var ItemPage = function (_React$Component) {
      _inherits(ItemPage, _React$Component);
  
      function ItemPage() {
          _classCallCheck(this, ItemPage);
  
          return _possibleConstructorReturn(this, Object.getPrototypeOf(ItemPage).apply(this, arguments));
      }
  
      _createClass(ItemPage, [{
          key: 'render',
          value: function render() {
  
              return React.createElement(_TestingView2.default, null);
          }
      }]);
  
      return ItemPage;
  }(React.Component);
  //# sourceMappingURL=item_page.js.map
  </code></pre>
  
  <p>Obviously the built script won't work on the client side because there is a required statement. It will throw me <code>Uncaught ReferenceError: require is not defined</code>.</p>
  
  <p>Is there any solution to compile it in a working script? I know of browserify but I can't find any info about how it can be integrated into the babel file watcher.</p>
  
  <p>Watcher config:</p>
  
  <pre><code>Program : /home/something/node_modules/.bin/babel
  Arguments :$FileDir$ --source-maps --out-dir /something/js/build
  Working directory: $ProjectFileDir$
  </code></pre>