MT WXML Transpiler
raw JSON → 0.0.4 verified Fri May 01 auth: no javascript
A forked version of wxml-transpiler (v0.0.4) that converts WXML (WeChat Mini Program template language) into standard HTML/JSX or other formats. It is in early development with no clear release cadence. Differentiators: maintained fork of an otherwise stale upstream. Currently limited documentation; suitable for developers needing WXML transformation in Node.js with a simple spawn/exec interface.
Common errors
error TypeError: Cannot read properties of undefined (reading 'replace') ↓
cause Calling transpile without providing a string input.
fix
Ensure you pass a string: transpile('...')
error Error: Unsupported format: jsx ↓
cause Format option not supported. Only 'html' or 'wxml' are valid.
fix
Use format: 'html' or omit for default.
Warnings
gotcha Package is a fork with minimal changes; rely on original wxml-transpiler docs at your own risk. ↓
fix Refer to wxml-transpiler documentation for API details, but verify behavior with this package.
deprecated No official support for WeChat Mini Program latest syntax (e.g., custom components, WXS). ↓
fix Consider using other tools like wepy or taro for full-featured conversion.
gotcha The package uses CommonJS internally but expects ESM import; CJS require fails silently. ↓
fix Use `import` syntax as shown in imports.
Install
npm install mt-wxml-transpiler yarn add mt-wxml-transpiler pnpm add mt-wxml-transpiler Imports
- transpile wrong
const transpile = require('mt-wxml-transpiler');correctimport { transpile } from 'mt-wxml-transpiler'; - compile wrong
import compile from 'mt-wxml-transpiler';correctimport { compile } from 'mt-wxml-transpiler'; - parse wrong
const { parse } = require('mt-wxml-transpiler').default;correctimport { parse } from 'mt-wxml-transpiler';
Quickstart
import { transpile } from 'mt-wxml-transpiler';
const inputWxml = `<view>Hello</view>`;
const output = transpile(inputWxml, {
format: 'html'
});
console.log(output); // <div>Hello</div>