{"id":42330,"library":"wxml-minifier","title":"wxml-minifier","description":"A minifier for WeChat Mini Program WXML files. Current stable version: 0.0.7. It removes whitespace and comments from WXML markup to reduce file size. This is a niche tool specifically for WeChat mini-program development, with no recent updates and limited options (whitespace and comment removal). Compared to generic HTML minifiers, it understands WXML syntax specifics.","status":"active","version":"0.0.7","language":"javascript","source_language":"en","source_url":"https://github.com/LeeJim/wxml-minifier","tags":["javascript","minifier","wxml","微信小程序","miniprogram","wechat"],"install":[{"cmd":"npm install wxml-minifier","lang":"bash","label":"npm"},{"cmd":"yarn add wxml-minifier","lang":"bash","label":"yarn"},{"cmd":"pnpm add wxml-minifier","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is CJS-only; no ESM export. Using ES import will fail.","wrong":"import minifier from 'wxml-minifier'","symbol":"minifier","correct":"const minifier = require('wxml-minifier')"},{"note":"In version 0.0.7, the exported function is a named export, not default. But require returns the function directly, so .default is not needed. However, if using ES import, you'd need to import as namespace.","wrong":"const minifier = require('wxml-minifier')","symbol":"minifier","correct":"const minifier = require('wxml-minifier').default"},{"note":"If you must use ESM, import all as namespace and call wxmlMinifier.default().","wrong":"import wxmlMinifier from 'wxml-minifier'","symbol":"minifier","correct":"import * as wxmlMinifier from 'wxml-minifier'"}],"quickstart":{"code":"const minifier = require('wxml-minifier');\nconst wxmlStr = `\n<view class=\"home\"         >\n<!-- test -->\n</view>\n`;\nconst minified = minifier(wxmlStr);\nconsole.log(minified); // <view class=\"home></view>","lang":"javascript","description":"Demonstrates basic usage: importing the CJS module and minifying a simple WXML string with whitespace and comment removal enabled by default."},"warnings":[{"fix":"Use require() or bundle with a CJS-compatible tool.","message":"Package is CJS only; ESM imports throw 'require is not defined' error in Node ESM mode.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Keep for existing projects, but evaluate for new projects.","message":"No updates since 2022; consider forking or using a generic HTML minifier with WXML-specific adjustments.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Set options { whitespace: false } to preserve whitespace in text nodes.","message":"Minification may remove essential whitespace in inline text content if whitespace option is true.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.0.7':15 'comment':20,49 'compar':51 'current':12 'develop':39 'file':11,26 'generic':53 'html':54 'javascript':61 'limit':45 'markup':23 'mini':8,37 'mini-program':36 'minifi':3,5,55,62 'miniprogram':65 'nich':31 'option':46 'program':9,38 'recent':42 'reduc':25 'remov':17,50 'size':27 'specif':33,60 'stabl':13 'syntax':59 'tool':32 'understand':57 'updat':43 'version':14 'wechat':7,35,66 'whitespac':18,47 'wxml':2,10,22,58,63 'wxml-minifi':1 '微信小程序':64","created_at":"2026-06-04T18:56:44.173007+00:00","updated_at":"2026-06-04T18:56:44.173007+00:00","problems":[{"fix":"Run 'npm install wxml-minifier' or 'npm i -D wxml-minifier'.","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'wxml-minifier'"},{"fix":"Use const minifier = require('wxml-minifier') or import * as wxmlMinifier from 'wxml-minifier' then wxmlMinifier.default().","cause":"Using ES import incorrectly (e.g., import minifier from 'wxml-minifier').","error":"TypeError: minifier is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/LeeJim/wxml-minifier#readme","github":"https://github.com/LeeJim/wxml-minifier","docs":null,"changelog":null,"pypi":null,"npm":"wxml-minifier","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}