Registry / devops / wx-code-minifier

wx-code-minifier

JSON →
library1.0.4jsnpmunverified

WeChat Mini Program code minifier that compresses WXML, WXSS, and JS files with a reported compression ratio of 25-30%. Current version 1.0.4 is stable with no recent updates. It provides configurable options for JS minification (using terser-like settings), CSS minification, and HTML template compression. Differentiates from other minifiers by targeting WeChat-specific file formats and integrating with mp-parser for preprocessing. The tool is CLI-based and can be used globally via npm. It does not support ESM imports and relies on a CommonJS config file.

npm install wx-code-minifier
INSTALL
IMPORT
SIG · WX-CODE-MINIFIER
W
wx-code-minifier
devopsjavascriptv1.0.4
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.

wx-code-minifier (CLI)
npm install -g wx-code-minifier; wx-code-minifier --src ./dist
npm install wx-code-minifier --save-dev; const minifier = require('wx-code-minifier')
This package is a CLI tool and cannot be imported programmatically. It should be installed globally and run as a command.
Config file
const config = require('./wxmin.config.js');
import config from './wxmin.config.js'
The config file uses CommonJS. ESM import will fail unless package.json has 'type': 'module' and file is renamed to .mjs.

Installs the minifier globally and runs it on the dist directory of a WeChat Mini Program project.

npm install -g wx-code-minifier cd your-miniapp-project wx-code-minifier --src ./dist
Debug
Known issues
gotchaCannot import package in Node.js code; only usable as CLI.
fix
Use the command line directly. If you need programmatic control, consider other minifiers like terser or clean-css.
affects: all
deprecatedConfig file uses CommonJS, may break in ESM-only projects.
fix
If your project uses 'type': 'module', rename wxmin.config.js to wxmin.config.cjs or use dynamic import.
affects: all
gotchaPackage has not been updated since 2020; potential compatibility issues with newer Node.js versions.
fix
Test on your Node.js version. Consider alternatives like miniprogram-ci which includes built-in minification.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'wx-code-minifier'
Package is not installed globally or not found in PATH.
fix
Run 'npm install -g wx-code-minifier' and ensure global npm bin directory is in your PATH.
SyntaxError: Unexpected token 'export'
Config file uses ESM syntax but package expects CommonJS.
fix
Use 'module.exports = { ... }' in wxmin.config.js instead of 'export default'.
Upgrade
Version history
1.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Amazon
1
Resources
wx-code-minifier — npm install wx-code-minifier · libregistry