Browserify plugin that bundles modules into a single scope, similar to Rollup, eliminating the require runtime wrapper. Current stable version is 3.5.0. Maintained sporadically; no major release since 2020. Differentiator: drastically reduces bundle size and execution overhead by rewriting require() calls to variable references and flattening module scopes. Unlike default browser-pack, it removes the per-module function wrapper and runtime, at the cost of potential execution order differences and incompatibility with certain patterns (e.g., wrapped require, factor-bundle). Supports an ecmaVersion option and IIFE removal via iife:false.
npm install browser-pack-flatVerified import paths — ran on the pinned version, not inferred.
Demonstrates using browser-pack-flat as a browserify plugin with IIFE removal, piping output to a file.
Ensure modules don't rely on interleaved execution; test thoroughly.
Use a different bundling strategy if you need code splitting.
Avoid wrapping require; use inline requires only.
If you need inlining of dynamic requires, pin to earlier version.
Use require('browser-pack-flat') instead of '/plugin'.Pipe through browser-unpack first: browserify app.js | browser-unpack | browser-pack-flat
Use .plugin(packFlat) or .plugin(require('browser-pack-flat'))No dependency data recorded yet.