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.fixRename file to minifix.config.mjs and use export default.
affects: >=1.0.0
gotchaInput/output file order must match. Mismatch causes silent errors.fixEnsure outputs array same length as inputs. Omit outputs for auto-naming.
affects: >=1.0.0
breakingNode 14 support dropped; engine requires >=16.fixUpgrade 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.fixUse 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.fixValidate 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.
fixRename to .mjs or add 'type': 'module' in package.json.
Error: Invalid input file: undefined
Output array longer than input array.
fixMatch lengths or omit outputs entirely.
TypeError: minifix.minify is not a function
Using CJS require() instead of ESM import.
fixSwitch 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).
fixRun npm install in project root or install minifix again.
Audit
Dependencies
terserrequiredJavaScript minification
clean-cssrequiredCSS minification
html-minifier-terserrequiredHTML minification
chokidarrequiredFile watching