This is a JavaScript bundler designed to streamline the process of combining multiple JavaScript files into a single, cohesive bundle. It's built on top of Bun, offering robust support for both require and import statements. enabling efficient management of dependencies within their projects.
-
Support for
require
andimport
Statements: It seamlessly handles bothrequire
andimport
statements, ensuring that all dependencies are accurately resolved and included in the final bundle. -
Circular Dependency Detection: It identifies and warns developers about any circular dependencies within their codebase, helping to prevent runtime errors and maintain code integrity.
-
Proper Code Ordering: It intelligently analyzes the dependencies between JavaScript files and arranges them in topological order. This ensures that modules are loaded and executed in the appropriate sequence, avoiding any potential issues related to undefined variables or functions (temporal dead zones).
-
Single Bundle Output: It consolidates all JavaScript files into a single bundle.
To install dependencies:
bun install
For help:
bun run index.js --help
To run:
bun run index.js --entryPoint "absolute\path\to\entry\JS\file" --exitPoint "absolute\path\to\target\directory"
bundlerOptions.json:
{
"onlyLocalImports" (bool) [default:true] {set to false to add dummy processes for external imports}
"targetFileName" (string) [default:"bundled_index.js"] {target file name to be saved to disk}
}