How do I get document injected into systemjs-builder for bundling a angular 4.0.0 app? : <p>I'm trying to bundle an angular 4.0.0 app.</p>

<p>I've tried browserify but the new angular-loader plugin (that allows for not needing the moduleId in components with templateUrl) does not get called and so the templates end up with the wrong path.</p>

<p>So I moved to systemjs-builder but the problem is that when it runs that plugin it crashes saying that document is not defined.</p>

<p>Is there a way to inject document into the builder?</p>

<p>Or am I doing something wrong?</p>

<p>This is the simple builder I'm testing ( the systemjs-config is the angular quickstart one).</p>

<pre><code>var path = require("path"); 
var Builder = require('systemjs-builder');

var builder = new Builder('src/frontend', 'src/frontend/systemjs.config.js');

builder .bundle('main.js', 'bundle.js') 
.then(function() {   
     console.log('Build complete'); 
}) 
.catch(function(err) {   
     console.log('Build error');   
     console.log(err); 
});
</code></pre>
