title: Breaking up an ES6 class into multiple files
body: <p>With a JavaScript 'class' (not really a class, I know), it's possible to break up a big definition by putting methods in separate files, like this:</p>
  
  <pre><code>var Foo = function () {
    console.log('initializing foo');
  };
  
  Foo.prototype.render = require('./render');
  </code></pre>
  
  <p>But with ES6 classes, it looks like the syntax rules out this approach – it seems the methods always have to be written as function literals inside the class block.</p>
  
  <p>I <a href="https://6to5.org/repl/#?experimental=true&amp;playground=true&amp;evaluate=true&amp;code=class%20Foo%20%7B%0A%20%20constructor()%20%7B%0A%20%20%20%20console.log(&#39;initializing%20foo&#39;)%3B%0A%20%20%7D%0A%20%20%0A%20%20require(&#39;.%2Frender&#39;)%3B%0A%7D%0A" rel="noreferrer">tried this</a> in the 6to5 REPL:</p>
  
  <pre><code>class Foo {
    constructor() {
      console.log('initializing foo');
    }
  
    require('./render');
  }
  </code></pre>
  
  <p>...but it errors.</p>
  
  <p>As an example, CoffeeScript's class syntax allows me to do this:</p>
  
  <pre><code>class Foo
    constructor: -&gt;
      console.log 'initializing foo'
  
    render: require './render'
  </code></pre>
  
  <p>Is there really no way to do this with ES6 classes?</p>