Template compiler for mpvue, a framework for building Mini Programs using Vue.js. Current stable version is 1.4.6. The compiler transforms Vue template syntax into target-specific code for WeChat, Alipay, Baidu, and Toutiao Mini Programs. Release cadence is irregular; ongoing maintenance on 1.x branch. Key differentiators: extends Vue syntax to Mini Programs, supports multiple platforms in 2.x. Requires mpvue-loader and mpvue core. Common issues arise from mismatched versioning between compiler and framework, and incorrect fileExt configuration.
npm install mpvue-template-compilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic compilation of a mpvue template using require() and compile() with platform option.
Ensure mpvue-template-compiler version equals mpvue version in package.json.
Add fileExt: { mp: '.wxml', wx: '.wxml' } (or appropriate platform extensions) in build config.Upgrade to mpvue 2.x only if multi-platform support is needed; otherwise stick with 1.x.
Use require() or configure bundler to handle CJS interop.
Always check result.errors after compile() and log or throw on any errors.
Always specify platform: 'wx' | 'alipay' | 'baidu' | 'toutiao'.
Change to const compiler = require('mpvue-template-compiler'); or use dynamic import with default export.Run npm install mpvue-template-compiler --save-dev (or --save) to add it explicitly.
Set type: 'module' in package.json and use import syntax, or use require() with CommonJS.
Use platform: 'wx' for WeChat, 'alipay' for Alipay, 'baidu' for Baidu, 'toutiao' for Toutiao.
Ensure you have mpvue-loader installed and properly configured in webpack.