systemjs / builder

SystemJS build tool
MIT License
465 stars 122 forks source link

Bundle several packages into one bundle #769

Closed dozer75 closed 7 years ago

dozer75 commented 7 years ago

I want to bundle several packages into one bundle, but when I try to do this, only the main of each package gets bundled, not dependent scripts. If I try to bundle each package for itself it works as expected.

Here is the bundle configuration I'm using:

const builder = new Builder("./");

builder.config({
    paths: {
        "angular2-cookie/*": "./node_modules/angular2-cookie/*.js",
        "rxjs/*": "./node_modules/rxjs/*.js"
    },
    map: {
        "angular2-cookie": "./node_modules/angular2-cookie",
        "rxjs": "./node_modules/rxjs"
    },
    packages: {
        "angular2-cookie": { main: "core.js", defaultExtension: "js" },
        "rxjs": { main: "Rx.js", defaultExtension: "js" }
    },
    meta: {
        "@angular/*": { build: false }
    }
});

//bundles correctly
builder.bundle("angular2-cookie", "./js/angular2-cookie.min.js", {
    sourceMaps: true,
    minify: true
});

//bundles correctly
builder.bundle("rxjs", "./js/rx.min.js", {
    sourceMaps: true,
    minify: true
});

//does not bundle correctly, only core.js and rx.js is bundled, nothing else
builder.bundle(["angular2-cookie", "rxjs"], "./js/bundle.min.js", {
    sourceMaps: true,
    minify: true
});

Is this an issue with systemjs-builder, or is there something I have done wrong with the package bundle definition?

guybedford commented 7 years ago

Use builder.bundle("angular2-cookie + rxjs") the array syntax does mean explicitly without dependencies.

dozer75 commented 7 years ago

Thanks, it worked, should maybe have been documented?