Skip to content

Instantly share code, notes, and snippets.

@jkuri
Created February 7, 2016 08:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkuri/9310c642e243156938a2 to your computer and use it in GitHub Desktop.
Save jkuri/9310c642e243156938a2 to your computer and use it in GitHub Desktop.
SystemJS build script for Angular2 with vendor included
var pkg = require('./package.json');
var path = require('path');
var Builder = require('systemjs-builder');
var name = pkg.name;
var builder = new Builder();
var config = {
baseURL: '.',
transpiler: 'typescript',
typescriptOptions: {
module: 'cjs'
},
map: {
typescript: './node_modules/typescript/lib/typescript.js',
angular2: path.resolve('node_modules/angular2'),
rxjs: path.resolve('node_modules/rxjs')
},
paths: {
'*': '*.js',
'moment': 'node_modules/moment/moment.js'
},
meta: {
'node_modules/angular2/*': { build: false },
'node_modules/rxjs/*': { build: false },
'moment': { 'format': 'global' }
},
};
builder.config(config);
builder
.bundle(name, path.resolve(__dirname, 'bundles/', name + '.js'))
.then(function() {
console.log('Build complete.');
})
.catch(function(err) {
console.log('Error', err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment