Registry / devops / minifix

minifix

JSON →
library1.0.22jsnpmunverified

A lightweight and flexible minifier for JavaScript, CSS, and HTML with live file-watching support. Powered by Terser, clean-css, and html-minifier-terser. Version 1.0.22 is current stable; updated infrequently (last release 2023). Works as CLI or API. Node >=16 required. Simpler than full build tools, but less configurable than individual minifiers.

npm install minifix
INSTALL
IMPORT
SIG · MINIFIX
M
minifix
devopsjavascriptv1.0.22
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

minifix
import minifix from 'minifix'
const minifix = require('minifix')
ESM-only; no CJS export since v1.0.22
MinifyOptions
import { MinifyOptions } from 'minifix'
TypeScript type; not exported as value
MinifixConfig
import { MinifixConfig } from 'minifix'
TypeScript type for config file shape

Shows programmatic usage to minify a JavaScript string with options, then references config file for CLI usage.

import minifix from 'minifix'; // Minify a JavaScript string const result = minifix.minify('const x = 1;', { js: { compress: { drop_console: true } } }); console.log(result.code); // 'const x=1;' // Minify with config file (assuming minifix.config.mjs exists) import config from './minifix.config.mjs'; // Or use the CLI: npx minifix
Debug
Known issues
gotchaConfig file must be ESM module (minifix.config.mjs). CJS (.cjs) not supported.
fix
Rename file to minifix.config.mjs and use export default.
affects: >=1.0.0
gotchaInput/output file order must match. Mismatch causes silent errors.
fix
Ensure outputs array same length as inputs. Omit outputs for auto-naming.
affects: >=1.0.0
breakingNode 14 support dropped; engine requires >=16.
fix
Upgrade Node.js to 16+ or use older minifix version (none published).
affects: >=1.0.0
deprecatedNo known deprecations yet.
gotchaLive watch creates output files even on no changes, triggering repeated rebuilds in some editors.
fix
Use external tools like `chokidar-cli` for watching if issues arise.
affects: >=1.0.0
gotchaminOptions are passed directly to underlying minifiers (terser, clean-css, html-minifier-terser). Invalid options may throw.
fix
Validate options against each minifier's docs.
affects: >=1.0.0
Errors
Common errors & fixes
file:///path/to/minifix.config.mjs:1 import minifix from 'minifix'; ^^^^^^^^^^^^^^ SyntaxError: Cannot use import statement outside a module
Config file is CJS (.js) but ESM syntax used.
fix
Rename to .mjs or add 'type': 'module' in package.json.
Error: Invalid input file: undefined
Output array longer than input array.
fix
Match lengths or omit outputs entirely.
TypeError: minifix.minify is not a function
Using CJS require() instead of ESM import.
fix
Switch to import minifix from 'minifix' and ensure package.json has 'type': 'module'.
Error: Cannot find module 'clean-css'
Missing dependency (npm install omitted peer dependencies).
fix
Run npm install in project root or install minifix again.
Upgrade
Version history
1.0.22latest on npm
Audit
Dependencies
terserrequiredJavaScript minification
clean-cssrequiredCSS minification
html-minifier-terserrequiredHTML minification
chokidarrequiredFile watching
Agent activity
9 hits · last 30 days
node
6
Resources
minifix — npm install minifix · libregistry