Go Bundler
raw JSON →Go Bundler is a JavaScript bundler engineered in Golang, designed for rapid asset compilation with minimal configuration. Currently at version 0.1.5, it remains in early development and is explicitly marked as not tested, to be used at one's own risk. Its core features include a built-in development server, automatic rebuilding upon file changes, and support for bundling HTML templates alongside JavaScript files. A key differentiator is its Go-based architecture, contributing to its stated fast performance. Non-JavaScript assets are automatically copied to the bundle directory and referenced as URLs. Due to its nascent stage, a predictable release cadence is not yet established, and it prioritizes ease of use and speed over extensive feature sets or stability guarantees.
Common errors
error command not found: go-bundler ↓
npx go-bundler to execute it, or define a script in your package.json (e.g., "build": "go-bundler") and run npm run build. error No config file found. Generating... ↓
go-bundler-config.json to your repository. Warnings
gotcha The package is explicitly labeled as 'STILL IN EARLY DEV AND NOT TESTED, USE AT YOUR OWN RISK' in its README. Stability and API guarantees are not provided, and breaking changes may occur frequently without major version bumps. ↓
gotcha Unlike many JavaScript bundlers, `go-bundler` is written in Go. This means its internal architecture and potential extension mechanisms (if any are introduced) will differ significantly from Node.js-based tools. It also affects how it's invoked programmatically. ↓
gotcha Initial setup requires an interactive session to generate the `go-bundler-config.json` file. This means it cannot be fully automated on a fresh install without simulating user input or manually creating the config. ↓
Install
npm install go-bundler yarn add go-bundler pnpm add go-bundler Imports
- CLI Execution wrong
import goBundler from 'go-bundler'; // Or require('go-bundler')correctnpx go-bundler - Configuration Generation
npx go-bundler // Run interactively in terminal - Programmatic Invocation wrong
const bundler = require('go-bundler'); bundler.build();correctimport { spawn } from 'child_process'; const bundlerProcess = spawn('npx', ['go-bundler'], { stdio: 'inherit' }); bundlerProcess.on('close', (code) => console.log(`Go Bundler exited with code ${code}`));
Quickstart
npm install --save-dev go-bundler
# After installation, run go-bundler to generate initial config:
npx go-bundler
# This will prompt you to answer questions and create `go-bundler-config.json`.
# Once configured, you can run it via an npm script, e.g., in package.json:
/*
"scripts": {
"build": "go-bundler build",
"dev": "go-bundler dev"
}
*/
# Then run: npm run dev