Systemjs-builder, basic useage / configuration
Andrew Henderson
Hello I'm trying to test the systemjs-builder, the readme has a nice getting started section but where do I put the builder code?
The code I'm referring to is below, I'm not sure where to put this (is this the builder.config?):
var path = require("path");
var Builder = require('systemjs-builder');
// optional constructor options
// sets the baseURL and loads the configuration file
var builder = new Builder('path/to/baseURL', 'path/to/system/config-file.js');
builder
.bundle('local/module.js', 'outfile.js')
.then(function() { console.log('Build complete');
})
.catch(function(err) { console.log('Build error'); console.log(err);
});Is there a demo build out there that I can look at?
21 Answer
You'd put that in your front-end building pipeline. For instance, inside of a gulp task.
While in a development build you could just serve all your files separately, in a production build you'd bundle and minify them to reduce the number of HTTP requests.