Bundling AngularJS + App with systemjs-builder

717 views
Skip to first unread message

c.sc...@briefdomain.de

unread,
Feb 10, 2016, 11:54:26 AM2/10/16
to SystemJS
Hello, currently I tried to bundle angularjs with systemjs-builder,
however it will include angularjs in the minified file, but it couldn't execute.

<!-- Extra Note: is there a way to handle @ngInject -->

This is my config, works fine without builder (running in browser):
System.config({
baseURL: '/',
map: {
angular: 'bower_components/angular/angular.js',
'angular-route': 'bower_components/angular-route/angular-route.js',
typescript: 'libs/typescript.js'
},
meta: {
'angular': {
format: 'global',
exports: 'angular',
deps: []
},
'angular-route': {
format: 'global',
deps: ['angular']
},
'main.js': {
deps: ['angular', 'angular-route']
}
},
transpiler: 'typescript'
});

And my builder:
var Builder = require('systemjs-builder');

var builder = new Builder('app', 'app/cfg.js');

builder.buildStatic('main.js', 'app/out.min.js', { minify: true, sourceMaps: true });

I'm on typescript 1.8, systemjs-builder 0.15.7,
any help would be great.

Guy Bedford

unread,
Feb 12, 2016, 12:33:30 PM2/12/16
to c.sc...@briefdomain.de, SystemJS
Can you share the output of your build file here that isn't running correctly?

--
You received this message because you are subscribed to the Google Groups "SystemJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to systemjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

c.sc...@briefdomain.de

unread,
Feb 12, 2016, 3:26:15 PM2/12/16
to SystemJS, c.sc...@briefdomain.de
Build file runs fine however the browser says "Angular is not defined".
Something like that: https://groups.google.com/forum/#!topic/systemjs/N8AE0HE8_EY
But I didn't understand whats going on. And since I'm specifing my deps manually I thought is something different

Guy Bedford

unread,
Feb 14, 2016, 9:06:41 AM2/14/16
to c.sc...@briefdomain.de, SystemJS
I think this may actually be an older regression where meta config does not permit map entries to be provided exactly - you'd either need to use paths instead of map, or specify the full name like "bower_components/angular/angular.js" in the meta config.

I've added a fix in https://github.com/systemjs/systemjs/commit/08f798f67fdb2b990b63d62a2af5e23cbdb4c06d that should make this work again, pending the next release.
Reply all
Reply to author
Forward
0 new messages