Registry / web-framework / wxml-transpiler

wxml-transpiler

JSON →
library1.0.5jsnpmunverified

WXML template compiler for WeChat Mini Programs, version 1.0.5. It transpiles WXML files into JavaScript render functions, similar to wcc.exe and wcc. Designed for build tooling and automation.

npm install wxml-transpiler
INSTALL
IMPORT
SIG · WXML-TRANSPILER
W
wxml-transpiler
web-frameworkjavascriptv1.0.5
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.

wxmlCompile
const { wxmlCompile } = require('wxml-transpiler')
const compiler = require('wxml-transpiler'); compiler.wxmlCompile(...)
CommonJS only; no ESM exports.
default
const compiler = require('wxml-transpiler')
import compiler from 'wxml-transpiler'
Package does not export a default, but CommonJS require returns the module object.
compile
const { compile } = require('wxml-transpiler')
const compile = require('wxml-transpiler').compile
The compile function is not exported; only wxmlCompile is available.

Compiles a list of WXML files using CommonJS require. Outputs generated JavaScript code.

const { wxmlCompile } = require('wxml-transpiler'); const fileList = [ './pages/index/index.wxml', './common/head.wxml', './common/foot.wxml' ]; const result = wxmlCompile(fileList); console.log(result);
Debug
Known issues
gotchaOnly CommonJS imports are supported; ESM (import) will fail as the package has no default export.
fix
Use require() instead of import.
affects: >=1.0.0
gotchaThe file list paths must be absolute or relative to the current working directory; otherwise compilation fails silently.
fix
Use path.resolve() to ensure absolute paths.
affects: >=1.0.0
gotchaThe package does not include TypeScript type definitions; type checking will be disabled.
fix
Create a custom .d.ts file if needed.
affects: >=1.0.0
gotchaThe output is a single string of JavaScript code; there is no AST or source map support.
fix
None; designed for simple compilation.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'wxml-transpiler'
The package is not installed or is installed globally but used locally.
fix
Run npm install wxml-transpiler in the project root.
require is not defined
Code is running in an ESM context where require is not available.
fix
Use createRequire from 'module' or switch to CommonJS.
wxmlCompile is not a function
Incorrect import; the function is not exported as default.
fix
Use const { wxmlCompile } = require('wxml-transpiler');
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
wxml-transpiler — npm install wxml-transpiler · libregistry