yarb (Yet Another Require Bundler) is a JavaScript module bundler designed for the browser environment, serving a similar purpose to Browserify. It focuses on bundling CommonJS-style modules and is currently at version 0.8.0. While its release cadence isn't explicitly stated, the version number suggests a more experimental or niche tool compared to its established alternatives. A key differentiator of yarb is its enhanced capability for defining dependencies between bundles, automatically identifying and excluding common files when using the `external` function, which simplifies multi-bundle setups. However, yarb is less flexible than Browserify, offering limited support for Node.js core modules (only `events`, `fs`, `module`, `net`, `path`, `stream`, `util`) and fewer configuration options. Internally, it utilizes vinyl objects for file representation, allowing for flexible input of buffers or streams, provided they have unique and absolute `path` properties.
npm install yarbVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of yarb to bundle a main entry file with a utility, apply a custom Browserify-compatible transform, and output the result to a file.
Ensure your browser bundle does not rely on unsupported Node.js core modules. Consider using browser-compatible alternatives or polyfills if absolutely necessary.
Before passing Vinyl objects to `yarb` (or `add`, `require`, `expose`), ensure their `path` properties are absolute and globally unique within the bundle context. Use `path.resolve()` if necessary.
If a transform needs to be applied globally (including `node_modules`), pass a `{ global: true }` option to the `transform` method: `bundle.transform(myTransform, { global: true })`.Carefully manage the loading order of your bundles in the browser. External bundles should always be `<script>`-loaded before dependent bundles to ensure proper resolution.
Evaluate if yarb meets your specific bundling needs. For complex scenarios, extensive core module polyfills, or a wider range of configuration options, consider Browserify or webpack.
Ensure the bundled output from `bundle.bundle()` is properly included in your HTML, typically within a `<script>` tag. Verify the bundle generation process completed successfully and produced output.
Check the module path for correctness. If it's not referenced from an entry point, use `bundle.add('./path/to/my-module-name.js')` or `bundle.require('./path/to/my-module-name.js')` to explicitly include it.Remove dependencies on unsupported Node.js core modules. For browser-side functionality, find alternative libraries that do not rely on Node.js specifics.
Inspect previous steps in the bundling chain for errors or misconfigurations. Ensure entry files exist and are correctly specified. Always handle the stream or provide a callback to `bundle.bundle()`.
No dependency data recorded yet.