Configurable JSPM Bundler

0.1.11 · active · verified Tue Apr 21

jspm-bundler is a Node.js build tool providing advanced, configurable bundling for applications built with JSPM. It allows developers to define and manage their bundle manifests in an external JavaScript file, `bundles.js`, rather than directly modifying `config.js`. This approach simplifies version control, enables independent updates of bundle configurations, and is especially useful in environments where `config.js` is dynamically generated or managed. The library supports bundling specific module groups, offers robust exclusion capabilities for packages or groups, implements cache busting through generated file checksums, and can produce self-extracting (static) bundles. Currently at version 0.1.11, the package demonstrates a maintenance cadence with recent updates addressing bug fixes, dependency compatibility, and adding new configuration options like `packagePath` and `configFile`. It serves a niche within the JSPM ecosystem by offering more granular control over the bundling process compared to JSPM's built-in bundler.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates initializing the bundler with a configuration, specifying bundle groups, and executing a bundle operation for a specific group.

var Bundler = require('jspm-bundler');

var bundler = new Bundler({
    baseURL: './',
    configFile: 'config.js',
    packagePath: './',
    dest: 'bundles',
    file: 'bundles.js',
    bust: false,
    builder: {
        sfx: false,
        minify: false,
        mangle: false,
        sourceMaps: true,
        separateCSS: false,
        lowResSourceMaps: true,
        config: {}
    },
    bundles: {
        appGroup: {
            bundle: true,
            combine: false,
            exclude: [],
            items: [
                'angular',
                'jquery',
                'source/app'
            ]
        },
        routesGroup: {
            bundle: true,
            items: {'source/routes': 'dist-routes'}
        }
    }
});

bundler.bundle(['appGroup']).then(function(){
    console.log('Successfully bundled appGroup.');
}).catch(function(err) {
    console.error('Error bundling appGroup:', err);
});

view raw JSON →