These are chat archives for systemjs/systemjs

31st
Dec 2015
Michael Sterba
@msterba
Dec 31 2015 00:55

How can I tell systemjs-builder just to bundle my transpiled files and not to include external dependencies like angular2 into the bundle, as they will be loaded via CDN?
Tried meta: angular2: { build: false } and bundle arithmetic - without success.

I have googled a lot but obviously I'm too inexperienced to recognize the solution. Any help or pointer to an working example project is appreciated!
Experimenting on a project based on ng2-play. System.config based on the one used here ng2-application-shell

System.config({
    transpiler: "none",
    map: {
        angular2: 'node_modules/angular2',
        rxjs: 'node_modules/rxjs',
        'reflect-metadata': 'node_modules/reflect-metadata/temp/Reflect.js',
        'zone.js': 'node_modules/zone.js/dist/zone.js'
    },
    meta: {
        angular2: { build: false }
    },
    packages: {
        angular2: {
            defaultExtension: "js"
        },
        rxjs: {
            defaultExtension: "js"
        }
    }
});
gulp.task("bundle", [ "compile" ], function() {
    var Builder = require("systemjs-builder");
    var builder = new Builder("./", "system.config.js");
    return builder.bundle("build/hello.js", "dist/app.js");
});
Michael Sterba
@msterba
Dec 31 2015 01:04
The resulting app.js contains angular2.js and rx.js. I want both libraries to be loaded via CDN.
Mel Woodgett
@mello151
Dec 31 2015 04:12
@msterba I think that instead of listing them in the map: {} they need to be listed in path: {}
Mel Woodgett
@mello151
Dec 31 2015 04:17
or change angular2 in meta to the actual path node_modules/angular2
Michael Sterba
@msterba
Dec 31 2015 04:34

Thanks for the hint @mello151
Figured it out some minutes ago (found the right hint in systemjs-builder issue 434). The wildcards in meta were missing:

System.config({
    transpiler: "none",
    map: {
        angular2: 'node_modules/angular2',
        rxjs: 'node_modules/rxjs'
    },
    meta: {
        "angular2/*": { build: false },
        "rxjs/*": { build: false }
    },
    packages: {
        angular2: { defaultExtension: "js" },
        rxjs: { defaultExtension: "js" }
    }
});

It's still not running, due to a loader problem, but the bundle only contains my files.

Sean Anderson
@MeoMix
Dec 31 2015 05:05
/@all Is there a (correct?) way to access System from within fetch if the method has its scope bound to another object (so this isn't System)? https://github.com/geelen/jspm-loader-css/blob/master/lib/CSSModuleLoaderProcess.js#L18 You can see that fetch has been bound here and then System is referenced explicitly throughout, but this causes bundling to fail if runtime: false is passed as an option.
zackschuster
@zackschuster
Dec 31 2015 05:08
question for y'all: i recently made a gulp-based build pipeline for bundling and view-related loading for angular 1.x, would any of you be interested in using that as a seed project/yo generator?
i'm thinking of making an oss project out of it & i'm curious what the interest would be, if any
Sean Anderson
@MeoMix
Dec 31 2015 05:42
Humm maybe that wasn't even the problem. Why on earth does this still want System
Sean Anderson
@MeoMix
Dec 31 2015 05:51
ohhhh crap
Sean Anderson
@MeoMix
Dec 31 2015 19:54
Alright, round 2. Lets see if I can figure this out. I think it's actually because jspm-loader-css is returning a promise in fetch, but not 100% on that at the moment. I know if I stub out the fetch then System isn't required.
Sean Anderson
@MeoMix
Dec 31 2015 20:43
Ayeee I figured out where the problem is. Now to understand how/why
Sean Anderson
@MeoMix
Dec 31 2015 22:05
Woop fixed it