{"id":15661,"library":"jspm-bundler","title":"Configurable JSPM Bundler","description":"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.","status":"active","version":"0.1.11","language":"javascript","source_language":"en","source_url":"https://github.com/crstffr/jspm-bundler","tags":["javascript","jspm","bundle"],"install":[{"cmd":"npm install jspm-bundler","lang":"bash","label":"npm"},{"cmd":"yarn add jspm-bundler","lang":"bash","label":"yarn"},{"cmd":"pnpm add jspm-bundler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core functionality relies on the JSPM builder; specific JSPM versions may cause compatibility issues.","package":"jspm","optional":false}],"imports":[{"note":"This package is a CommonJS module and must be imported using `require()` syntax. Direct ESM `import` will not work.","wrong":"import Bundler from 'jspm-bundler';","symbol":"Bundler","correct":"var Bundler = require('jspm-bundler');"}],"quickstart":{"code":"var Bundler = require('jspm-bundler');\n\nvar bundler = new Bundler({\n    baseURL: './',\n    configFile: 'config.js',\n    packagePath: './',\n    dest: 'bundles',\n    file: 'bundles.js',\n    bust: false,\n    builder: {\n        sfx: false,\n        minify: false,\n        mangle: false,\n        sourceMaps: true,\n        separateCSS: false,\n        lowResSourceMaps: true,\n        config: {}\n    },\n    bundles: {\n        appGroup: {\n            bundle: true,\n            combine: false,\n            exclude: [],\n            items: [\n                'angular',\n                'jquery',\n                'source/app'\n            ]\n        },\n        routesGroup: {\n            bundle: true,\n            items: {'source/routes': 'dist-routes'}\n        }\n    }\n});\n\nbundler.bundle(['appGroup']).then(function(){\n    console.log('Successfully bundled appGroup.');\n}).catch(function(err) {\n    console.error('Error bundling appGroup:', err);\n});","lang":"javascript","description":"Demonstrates initializing the bundler with a configuration, specifying bundle groups, and executing a bundle operation for a specific group."},"warnings":[{"fix":"Update your configuration to use `dest` and `file` instead of the old names. For example, `dest: 'bundles'` instead of `bundleDest: 'bundles'`.","message":"The configuration options `bundleDest` and `bundleFile` were renamed to `dest` and `file` respectively.","severity":"breaking","affected_versions":"<0.1.2"},{"fix":"Remove any `gzip` related configuration options from your bundler setup. If gzip compression is required, it must be handled as a separate post-processing step outside of jspm-bundler.","message":"Gzip compression support was removed from the bundler.","severity":"breaking","affected_versions":">=0.1.5"},{"fix":"If using self-extracting bundles, set `bust: false`. If cache busting is critical, avoid `sfx: true` and rely on standard JSPM bundles and `bust` functionality.","message":"Cache busting (`bust: true`) is incompatible with self-extracting bundles (`builder.sfx: true`). Cache busting relies on separate checksums for individual modules, which are not applicable to a single, statically built output file.","severity":"gotcha","affected_versions":">=0.1.3"},{"fix":"Exercise caution when using specific JSPM versions with jspm-bundler. If encountering unexpected bundling issues, check the `jspm-bundler` release notes for known JSPM compatibility concerns and consider pinning to a known stable JSPM version.","message":"The bundler experienced compatibility issues with JSPM v0.16.34, leading to a reversion of updates to that specific JSPM version.","severity":"gotcha","affected_versions":"0.1.8, 0.1.9"},{"fix":"Ensure that `bundler.baseURL` is identical to `System.baseURL` configured for your JSPM project. Mismatches can lead to module resolution errors during bundling.","message":"The `baseURL` option in the jspm-bundler configuration must precisely match the `baseURL` defined in your SystemJS `config.js`.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Use CommonJS `require` syntax: `var Bundler = require('jspm-bundler');`","cause":"Attempting to use `jspm-bundler` with ESM `import` syntax in a Node.js environment.","error":"Cannot read properties of undefined (reading 'bundle')"},{"fix":"Verify that all specified file paths and names are valid and accessible for writing. Avoid invalid characters or conflicting directory/file names.","cause":"The `dest` or `file` options, or custom filenames specified in `bundles.groupName.items` as object values, are not valid file system paths or names.","error":"Error: \"Invalid destination filename\""},{"fix":"Update `jspm-bundler` to version `0.1.7` or newer, which contains a fix for this bug.","cause":"A bug in earlier versions caused the bundling promise to resolve before the operation was complete, leading to race conditions or incorrect assumptions about bundle readiness.","error":"Error: \"bundle() promise resolving too soon\""},{"fix":"Update `jspm-bundler` to version `0.1.2` or newer. If staying on an older version, treat `unbundle()` as synchronous or use callbacks where applicable.","cause":"In versions prior to 0.1.2, the `unbundle()` method incorrectly did not return a Promise, making it difficult to chain operations or handle completion asynchronously.","error":"Error: \"unbundle() not returning promise\""}],"ecosystem":"npm"}