Node.js wrapper for WeChat Mini Program official compilers (wcc for WXML, wcsc for WXSS). Version 0.2.3 is the latest stable release. It enables compiling .wxml and .wxss files into JavaScript functions that can render virtual DOM or CSS strings. Compared to alternatives like @vant/weapp or raw CLI tools, this package provides a programmatic API suitable for server-side rendering or testing. Release cadence is low; limited to basic compilation use. Only for Node.js (CJS only).
npm install miniprogram-compilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Compiles a .wxml file into a virtual DOM generator using the provided project root.
Use require() or configure bundler to handle CJS modules.
Use path.resolve() to provide an absolute path.
Ensure the directory exists and contains valid project files.
Use new Function('global', compilerString) and then invoke with an object.Pass relative paths like 'pages/index/index.wxml'.
Use new Function('global', compilerString) to create a function.Ensure the project root contains the expected files and that you called compiler({}) correctly.