CrudeBuild.js
raw JSON → 0.1.3 verified Sat Apr 25 auth: no javascript
CrudeBuild.js is a minimalist JavaScript build tool for single-file libraries. Version 0.1.3 (released 2025) requires no configuration and has zero dependencies, automatically minifying files with Google Closure Compiler, generating browser-ready output, CommonJS (.cjs) and ES module (.mjs) exports, and extracting metadata headers from package.json. It is a lightweight alternative to tools like esbuild or rollup for simple projects. Released under the MIT license.
Common errors
error crude-build: command not found ↓
cause Not installed globally or not in PATH.
fix
Use npx crude-build or install locally via npm i -D crude-build and run via npx.
error Error: Cannot find module '...' ↓
cause Missing input file (package.json or main entry).
fix
Run from project root with valid package.json and a main file.
error Output file is empty or not minified ↓
cause Module name argument mismatch or missing source file.
fix
Ensure the module name matches the source file (e.g., 'MyModule' expects 'MyModule.js' in current dir).
Warnings
gotcha The argument to crude-build is the module name, not a file path. Using a path will fail silently or produce incorrect output. ↓
fix Use only the module name (e.g., 'MyModule') not a file path like 'src/index.js'.
gotcha CrudeBuild relies on Google Closure Compiler via a bundled binary? Check license compliance; closure compiler uses Apache 2.0. ↓
fix Ensure your project complies with the Closure Compiler license if redistributing.
gotcha No configuration options; cannot customize minification, header format, or output directory. ↓
fix If you need customization, switch to a more mature tool like esbuild or rollup.
gotcha package.json must have 'name' and 'version' fields; otherwise header generation may error. ↓
fix Ensure your package.json contains at least name and version.
Install
npm install crude-build yarn add crude-build pnpm add crude-build Imports
- default (CLI) wrong
import crudeBuild from 'crude-build'correctnpx crude-build ModuleName - package.json scripts wrong
"build": "crude-build --entry ModuleName"correct"build": "crude-build ModuleName"
Quickstart
// Install
npm install crude-build
// In package.json add:
"scripts": {
"build": "crude-build MyModule"
}
// Then run:
npm run build
// Output in dist/: MyModule.js (minified), MyModule.cjs, MyModule.mjs