A simple, fast, and modern JavaScript bundler powered by esbuild.
Lightweight, easy to use, and perfect for small to medium projects.
Installation β’ Quick Start β’ Usage β’ Configuration β’ Examples
- β‘ Lightning Fast - Bundles JavaScript in milliseconds using esbuild
- π§ Zero Config - Works out of the box, no configuration needed
- βοΈ Minification - Optional built-in minification
- π Build Reports - See exactly what's contributing to your bundle size
- π Watch Mode - Auto-rebuild on file changes during development
- πΊοΈ Source Maps - Debug with linked or inline source maps
- π¨ Beautiful Output - Colored CLI with helpful messages
- π€ Non-Interactive Mode - Perfect for CI/CD pipelines
- π Config Files - Support for JSON configuration files
- Node.js: v18 or higher (required for npm installation and Go binary)
- Go: v1.21 or higher (only if building from source)
- Operating System: Windows, macOS, or Linux
# Install globally
npm install -g jspackr
# Verify installation
jspackr --version# Install latest version
go install github.com/kalokaradia/jspackr@latest
# Verify installation
jspackr --version# Clone the repository
git clone https://github.com/kalokaradia/jspackr.git
cd jspackr
# Build the binary
go build -o bin/jspackr src/main/main.go
# Make it executable (Linux/macOS)
chmod +x bin/jspackr
# Run directly
./bin/jspackr --versionDownload the appropriate binary for your platform from the releases page:
# Linux/macOS
sudo mv jspackr /usr/local/bin/jspackr
# Windows
# Move jspackr.exe to your PATHBundle a JavaScript file with default settings:
jspackr src/index.jsThis creates:
dist/bundle.js
jspackr -i src/index.js -o dist/app.js -m -r -wThis will:
- π₯ Bundle
src/index.js - π€ Write to
dist/app.js - βοΈ Minify the output
- π Show build report
- π Watch for changes
jspackr [options]| Short | Long Form | Description | Default |
|---|---|---|---|
-i |
--input <file> |
Entry JavaScript file | Required |
-o |
--out <file> |
Output bundle file | dist/bundle.js |
-c |
--config <file> |
Path to config file | Optional |
-m |
--minify |
Minify the output | false |
-r |
--report |
Generate build report | false |
-s |
--source <mode> |
Source map mode: none, linked, inline |
none |
-w |
--watch |
Enable watch mode | false |
--log-level <level> |
Log level: debug, info, warn, error |
info |
|
-f |
--force |
Force overwrite without confirmation | false |
-y |
--yes |
Auto-confirm all prompts | false |
-n |
--no-confirm |
Skip all confirmation prompts | false |
-v |
--version |
Show version (standalone) | - |
-h |
--help |
Show help message | - |
# Show help
jspackr --help
# Show version
jspackr --versionCreate a jspackr.config.json file for persistent configuration:
{
"input": "./src/index.js",
"output": "./dist/bundle.js",
"minify": true,
"report": true,
"sourceMap": "linked",
"watch": false,
"logLevel": "info"
}| Option | Type | Description |
|---|---|---|
input |
string | Entry JavaScript file path |
output |
string | Output bundle file path |
minify |
boolean | Minify the output bundle |
report |
boolean | Generate build report |
sourceMap |
string | Source map mode: none, linked, inline |
watch |
boolean | Enable watch mode |
logLevel |
string | Log verbosity: debug, info, warn, error |
# Use default config (jspackr.config.json)
jspackr
# Specify custom config file
jspackr -c custom.config.json# Bundle a single file
jspackr -i src/index.js
# With custom output
jspackr -i src/index.js -o dist/app.js# Minified with source map and report
jspackr -i src/index.js -o dist/app.min.js -m -r -s inline# Watch for changes and rebuild automatically
jspackr -i src/index.js -o dist/app.js -w# Force overwrite, skip all confirmations
jspackr -i src/index.js -o dist/app.js -f
# Or with yes flag
jspackr -i src/index.js -o dist/app.js -y
# Or completely non-interactive
jspackr -i src/index.js -o dist/app.js -nCreate jspackr.config.json:
{
"input": "./src/app.js",
"output": "./build/app.js",
"minify": true,
"report": true
}Run:
jspackr# Debug mode
jspackr -i src/index.js --log-level debug
# Quiet mode
jspackr -i src/index.js --log-level warn# Production-ready bundle with all features
jspackr \
--input src/index.js \
--output dist/app.js \
--minify \
--report \
--source linked \
--log-level infoWhen using the --report flag, jspackr generates a detailed breakdown:
Bundle Size: 45.2 KB
β±οΈ Build Time: 123ms
π¦ Dependencies:
src/utils.js 12.3 KB
src/helpers.js 8.1 KB
src/index.js 2.4 KB
...
| Mode | Flag Value | Description |
|---|---|---|
| None | none |
No source map (default) |
| Linked | linked |
Separate .map file linked via comment |
| Inline | inline |
Embedded as base64 in the bundle |
# Linked source map
jspackr -i src/index.js -s linked
# Inline source map
jspackr -i src/index.js -s inlinejspackr/
βββ bin/ # Compiled binaries
βββ src/
β βββ cli/ # CLI output and styling
β β βββ logger.go # Logging functionality
β β βββ styles.go # Colored output styles
β β βββ ui.go # UI components
β βββ config/ # Configuration management
β β βββ config.go # Config structures
β β βββ loader.go # JSON config loading
β β βββ merger.go # Config merging
β β βββ validator.go # Config validation
β βββ core/
β β βββ builder/ # Bundling logic
β β β βββ builder.go # Main builder
β β β βββ report.go # Build reporting
β β β βββ sourcemap.go # Source map handling
β β βββ watcher/ # File watching
β β βββ debouncer.go
β β βββ hasher.go
β β βββ watcher.go
β βββ main/
β β βββ main.go # Entry point
β βββ utils/
β βββ confirm.go # Confirmation prompts
β βββ file.go # File utilities
β βββ flags.go # CLI flags parsing
βββ .gitignore
βββ .npmignore
βββ go.mod
βββ go.sum
βββ LICENSE
βββ logo.svg
βββ package.json
βββ README.md
If jspackr is not found after installation:
# Add to PATH (npm global)
npm config get prefix
# Add the output path to your shell profile
# Or for Go installation
echo 'export PATH="$HOME/go/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc# Linux/macOS
sudo chown $(whoami) /usr/local/bin/jspackr
# Or use npm with sudo (not recommended)
sudo npm install -g jspackr# Check version
node --version
# Update using nvm (Linux/macOS)
nvm install 18
nvm use 18
# Or download from nodejs.org# Clear cache and rebuild
go clean -cache
go build -o bin/jspackr src/main/main.go
# Check dependencies
go mod download
go mod verify# Ensure you're not using network drives
# Check file permissions
ls -la src/
# Try with absolute paths
jspackr -i /absolute/path/to/index.jsContributions are welcome! Please feel free to submit a Pull Request.
# Fork the repository
git clone https://github.com/YOUR-USERNAME/jspackr.git
cd jspackr
# Create a feature branch
git checkout -b feature/amazing-feature
# Make changes
# Test your changes
go test ./...
# Commit your changes
git commit -m "Add amazing feature"
# Push to GitHub
git push origin feature/amazing-feature
# Open a Pull Request- Follow Go formatting conventions (
gofmt) - Add comments for public functions
- Write tests for new features
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- esbuild for the amazing bundling engine
- fatih/color for colored terminal output
- All contributors and users!
- Author: Kaloka Radia Nanda
- GitHub: @kalokaradia
- Issues: Report a bug
Made with β€οΈ by Kaloka Radia Nanda