Tripack is a minimal JavaScript bundler, version 0.1.1, specifically designed for educational purposes rather than production use. It aims to demystify the core concepts behind modern bundlers like webpack and Rollup by implementing fundamental features from scratch. These features include AST parsing using `acorn`, building a comprehensive dependency graph, performing ESM to runtime-compatible transformations, and optionally executing export-level tree-shaking. The package emphasizes readability and simplicity in its codebase structure (e.g., `parser.ts`, `resolver.ts`, `treeshaker.ts`). While there's no explicit release cadence, its low version number suggests ad-hoc updates focused on clarity and concept demonstration. Its key differentiator is its role as a learning tool, providing a transparent view into bundling mechanics, unlike complex production-grade alternatives.
npm install tripackVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install `tripack` globally and use its command-line interface to bundle a JavaScript entry file with optional tree-shaking into a single output file.
For production applications, consider established bundlers like webpack, Rollup, or esbuild that offer robust features, optimizations, and community support.
Be aware that not all unused code might be eliminated. Review the bundled output if strict tree-shaking is critical for your use case. This limitation is by design for simplicity.
Identify and refactor your module dependencies to break circular references, as they can indicate architectural problems and complicate code comprehension and maintenance.
When running `tripack` from the command line, always include `--entry <path/to/your/entry.js>` to specify your application's entry point.
Update your Node.js installation to version 20 or later using a tool like `nvm` (Node Version Manager) or by downloading the latest LTS version from the official Node.js website.
If running `tripack` locally, ensure you've run `npm install` in the project root. If using a global install, `npm install -g tripack` should handle dependencies, but local issues can occur. Reinstalling globally might help: `npm install -g tripack`.