{"id":13269,"library":"gulp-dumber","title":"Gulp plugin for dumber bundler","description":"gulp-dumber is a Gulp plugin that integrates the dumber JavaScript bundler into Gulp build pipelines. Released as version 3.0.0 in September 2024, it currently targets Node.js 18 and above. The dumber bundler differentiates itself from all-in-one solutions by strictly adhering to the Unix philosophy: it focuses solely on tracing dependencies and packing modules, intentionally omitting features like transpiling, minification, or serving. These responsibilities are left to other Gulp plugins (e.g., gulp-babel, gulp-typescript, gulp-terser), providing users with granular control and flexibility over their build process. It utilizes dumber-module-loader, an AMD loader, for runtime module resolution, supporting npm packages and flexible code splitting. A key design choice is the absence of a fixed entry module, and it manages local source dependencies passively, warning about unfulfilled dependencies but still bundling, allowing for runtime loading of missing modules. It does not support multiple versions of the same npm package within a single bundle. gulp-dumber is often used as part of project scaffolds generated by npx makes dumberjs for modern SPA frameworks like Aurelia, React, or Vue.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/dumberjs/gulp-dumber","tags":["javascript","dumber","bundler","gulpplugin"],"install":[{"cmd":"npm install gulp-dumber","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-dumber","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-dumber","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency as it's a Gulp plugin, required for defining and running build tasks.","package":"gulp"},{"reason":"The core bundler library that this plugin integrates; gulp-dumber v3 requires dumber v3 for compatibility and functionality.","package":"dumber"}],"imports":[{"note":"CommonJS `require` is the traditional and still widely used method for importing Gulp plugins within `gulpfile.js`.","wrong":"import dumber from 'gulp-dumber';","symbol":"dumber","correct":"const dumber = require('gulp-dumber');"},{"note":"ESM `import` syntax is supported for Node.js >=18 environments when the project or Gulpfile is configured for ESM (e.g., 'type': 'module' in package.json or using .mjs extension).","wrong":"const dumber = require('gulp-dumber');","symbol":"dumber","correct":"import dumber from 'gulp-dumber';"},{"note":"The imported `dumber` is a factory function. It must be called (`dumber({...})`) to return a Gulp plugin stream instance (commonly named `dr`) which is then piped.","wrong":"stream.pipe(dumber())","symbol":"dr() (plugin instance)","correct":"stream.pipe(dr())"}],"quickstart":{"code":"const gulp = require('gulp');\nconst dumber = require('gulp-dumber');\nconst babel = require('gulp-babel'); // Example pre-processor, install separately\nconst merge2 = require('merge2'); // To combine multiple streams, install separately\n\n// 1. Configure the dumber instance with options\nconst dr = dumber({\n  // Optional: customize the main bundle name (default 'entry-bundle.js')\n  // entryBundle: 'main-app',\n  // Optional: enable cache busting by adding content hashes to filenames\n  // hash: true,\n  // Optional: callback to consume the manifest generated by dumber\n  // onManifest: (manifest) => { console.log(manifest); }\n});\n\n// 2. Define a task to transpile JavaScript files\n// dumber itself does not transpile; pre-processing like Babel must happen before.\nfunction transpileJs() {\n  return gulp.src('src/**/*.js')\n    .pipe(babel({ presets: ['@babel/preset-env'] })); // Requires @babel/core & @babel/preset-env\n}\n\n// 3. Define a task to process other static assets (HTML, JSON, CSS, etc.)\n// dumber can directly handle these file types after any necessary pre-processing.\nfunction processOtherAssets() {\n  return gulp.src(['src/**/*.html', 'src/**/*.json', 'src/**/*.css']);\n}\n\n// 4. Define the main bundling task\nfunction bundleApp() {\n  // Combine all pre-processed and raw asset streams into a single stream\n  // using merge2, then pipe them to the gulp-dumber plugin instance.\n  // dumber will then trace dependencies, pack modules, and output bundles.\n  return merge2(\n      transpileJs(),\n      processOtherAssets()\n    )\n    .pipe(dr()) // The gulp-dumber plugin acts as a transform stream here\n    .pipe(gulp.dest('dist')); // Write the resulting bundles to the 'dist' folder\n}\n\n// Export tasks for the Gulp CLI\nexports.build = bundleApp;\nexports.default = bundleApp;\n\n// To run this example:\n// 1. Install dependencies: `npm install --save-dev gulp gulp-dumber gulp-babel @babel/core @babel/preset-env merge2`\n// 2. Create example files in a 'src' directory: e.g., src/index.html, src/app.js (with an ES module import), src/style.css\n// 3. Run the build: `gulp build`\n","lang":"javascript","description":"Demonstrates a typical Gulp build pipeline using gulp-dumber. This example includes pre-transpilation with Babel and combines multiple asset streams, highlighting dumber's specific role as a bundler focusing on trace and pack, not pre-processing."},"warnings":[{"fix":"Review the dumber v3 changelog for any API changes and update your dumber configuration and options accordingly. Ensure the `dumber` package is explicitly updated to v3 or higher in your project dependencies.","message":"gulp-dumber v3 requires dumber v3. Ensure compatibility with the underlying `dumber` library, as breaking changes in `dumber` itself may affect `gulp-dumber`'s usage and configuration.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Refactor Gulp tasks to use `gulp.series()` and `gulp.parallel()` for composing tasks instead of passing arrays of task names. Consult the official Gulp 4 migration guides for detailed instructions.","message":"Gulp 4 introduced significant changes to task composition, replacing arrays of task names with `gulp.series()` and `gulp.parallel()`. Users migrating from Gulp 3 must update their task definitions.","severity":"breaking","affected_versions":">=3.0.0 (in context of Gulp 4)"},{"fix":"Integrate appropriate pre-processor plugins (e.g., `gulp-babel`, `gulp-typescript`, `gulp-sass`, `gulp-less`) and minification plugins (e.g., `gulp-terser`, `gulp-clean-css`) into your Gulp pipeline *before* the `dr()` stream to pre-process assets.","message":"The `dumber` bundler (and therefore `gulp-dumber`) explicitly does NOT perform transpilation (e.g., TypeScript, Babel, Sass, Less) or minification. These steps must be handled by separate Gulp plugins *before* piping files to `gulp-dumber`.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure all local source files and their explicit or implicit dependencies are correctly included in the Gulp `src` streams that feed into `gulp-dumber` to prevent unexpected runtime loading of local files from remote sources.","message":"dumber is 'passive' on local module dependencies. It will warn if a local dependency is not found in the Gulp stream but will still bundle, relying on the `dumber-module-loader` to potentially load missing modules at runtime.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Standardize npm package versions across your project dependencies. Tools like `npm dedupe` or `yarn install --flat` can help resolve conflicts. Carefully manage your `package.json` to avoid conflicting dependencies where specific versions are critical.","message":"dumber does not support bundling multiple versions of the same npm package. If version conflicts exist in your dependency tree, it bundles the top-level installed version, which might lead to unexpected behavior if specific versions are required by different parts of the application.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Update your Gulp task definitions to Gulp 4 syntax by using `gulp.series()` or `gulp.parallel()` for task composition: for example, `gulp.task('name', gulp.series('dependency-task', func));`.","cause":"Attempting to define a Gulp task using Gulp 3 syntax (e.g., `gulp.task('name', ['dependency-task'], func)`) in a Gulp 4 environment.","error":"AssertionError [ERR_ASSERTION]: Task function must be specified"},{"fix":"Verify all pre-processor plugins are installed (`npm install --save-dev [plugin-name]`), correctly configured (e.g., `.babelrc`, `tsconfig.json`), and that their Gulp streams are correctly chained and produce Vinyl files as expected before being fed into `gulp-dumber`.","cause":"This typically indicates that a required pre-processor plugin (e.g., `gulp-babel`, `gulp-typescript`) is either not installed, not correctly configured, or the stream it generates is empty or malformed before being piped to `gulp-dumber`.","error":"TypeError: Cannot read properties of undefined (reading 'pipe') or similar stream errors when piping pre-processed files"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"gulp","cli_version":null}