Browserify and Legacy Tools

Browserify and the Legacy Toolchain

You will still meet these tools in older codebases and tutorials. Each solved a real problem of its time that now has a better answer.

Milestones in front-end build tooling, from task runners to native bundlers
Milestones in front-end build tooling, from task runners to native bundlers

Browserify 169,830 (2011) let browsers use Node.js-style require() and npm 2,036 packages for the first time: browserify main.js > bundle.js walked the require calls and concatenated the modules into one file with a tiny module loader. It still installs and runs (17.0.1), but it is built around CommonJS, so ES-module code needs extra transforms.

Grunt 70,395 (2012) and Gulp 57,051 (2013) are task runners, not bundlers. Grunt configures plugins in one large configuration object; Gulp replaced configuration with code and pipes files through in-memory streams. Gulp 5 (March 2024) still suits file-oriented chores such as copying assets, optimizing images or orchestrating a modern bundler:

gulpfile.mjs: a Gulp 5 build that delegates JavaScript bundling to esbuildJavaScript
import { src, dest, series, parallel, watch } from 'gulp';
import { build } from 'esbuild';
import { rm } from 'node:fs/promises';
const clean = () => rm('dist', { recursive: true, force: true });
const html = () => src('src/*.html').pipe(dest('dist'));
const scripts = () =>
  build({ entryPoints: ['src/index.js'], bundle: true, minify: true, outdir: 'dist' });
export const buildAll = series(clean, parallel(html, scripts));
export default () => watch('src/**/*', buildAll);

Running npx gulp buildAll logs each task as it starts and finishes; clean runs first, then html and scripts in parallel:

Output of 50
[12:08:42] Using gulpfile ~\gulp-demo\gulpfile.mjs
[12:08:42] Starting 'buildAll'...
[12:08:42] Starting 'clean'...
[12:08:42] Finished 'clean' after 1.95 ms
[12:08:42] Starting 'html'...
[12:08:42] Starting 'scripts'...
[12:08:42] Finished 'html' after 32 ms
[12:08:42] Finished 'scripts' after 39 ms
[12:08:42] Finished 'buildAll' after 43 ms

Bower 80,366 (2012) installed front-end libraries such as jQuery 561 into a bower_components folder, separately from npm. Its home page now says that while Bower is maintained, it recommends Yarn 11,798 and Vite 25,978 for front-end projects.

A classic interview question is "What is the difference between a task runner and a bundler?" A task runner executes steps you define on files; a bundler understands the module graph and decides what code ships.