title: Concatenate files using babel
body: <p>Here's my file structure</p>
  
  <pre><code>/base.js
      /foo/main.js
          /foo/bar/main.js
      /baz/main.js
  </code></pre>
  
  <p>I want 4 files in total. One for each leaf node of the tree with all the content of it's 'included' files. Here are file's contents.</p>
  
  <p>base.js</p>
  
  <pre><code>//anything really
  </code></pre>
  
  <p>/foo/main.js</p>
  
  <pre><code>include 'base.js'
  </code></pre>
  
  <p>/foo/bar/main.js</p>
  
  <pre><code>include 'base.js'
  include '/foo/main.js'
  </code></pre>
  
  <p>/baz/main.js</p>
  
  <pre><code>include 'base.js'
  </code></pre>
  
  <p>These 'includes' are like php includes in that they are concatenated at babel's compile time not the traditional includes from es2016/es2016. I want to have each file be babel compiled for past versions of ES and have all the contents of it's include hierarchy before I put them up for serving. They will not be on a node server. This will be traditional php/apache hosting. Babel is just for transpiring purposes.</p>
  
  <p>I know I can compile all my js in a single file with the <code>--out-file</code> option and I can import and export modules but how can I make babel concatenate different files without having to write and maintain cli command and just by having 'include' directives at the top of the files.</p>