Search code examples
gulpjspmsystemjs

JSPM multiple bundles, vendor and app


Bundling with JSPM is easy, here is a simple task:

var exec = require('child_process').exec;

gulp.task('jspmBuild', function (cb) {
        exec('jspm bundle-sfx src/app/app.js dist/app.min.js --skip-source-maps', function (err, stdout, stderr) {
            cb(err);
        });
    });

What I would like to do, is have two separate bundles, one for the vendor files and one for the actual app.

Is that possible?


Solution

  • See https://github.com/jspm/jspm-cli/blob/master/docs/production-workflows.md

    and try

    $ jspm bundle-sfx vendor1 + vendor2 dist/vendor.min.js --skip-source-maps
    $ jspm bundle-sfx src/app/app.js - vendor1 - vendor2 dist/app.min.js --skip-source-maps
    

    See also https://github.com/systemjs/systemjs/blob/master/docs/config-api.md#packages

    You can configure more complex settings with packages option if you want.