{"id":26660,"library":"wxml-transpiler","title":"wxml-transpiler","description":"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.","status":"active","version":"1.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/IOriens/wxml-transpiler","tags":["javascript","wxml","wcc","transpiler","compiler"],"install":[{"cmd":"npm install wxml-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add wxml-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add wxml-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CommonJS only; no ESM exports.","wrong":"const compiler = require('wxml-transpiler'); compiler.wxmlCompile(...)","symbol":"wxmlCompile","correct":"const { wxmlCompile } = require('wxml-transpiler')"},{"note":"Package does not export a default, but CommonJS require returns the module object.","wrong":"import compiler from 'wxml-transpiler'","symbol":"default","correct":"const compiler = require('wxml-transpiler')"},{"note":"The compile function is not exported; only wxmlCompile is available.","wrong":"const compile = require('wxml-transpiler').compile","symbol":"compile","correct":"const { compile } = require('wxml-transpiler')"}],"quickstart":{"code":"const { wxmlCompile } = require('wxml-transpiler');\nconst fileList = [\n  './pages/index/index.wxml',\n  './common/head.wxml',\n  './common/foot.wxml'\n];\nconst result = wxmlCompile(fileList);\nconsole.log(result);","lang":"javascript","description":"Compiles a list of WXML files using CommonJS require. Outputs generated JavaScript code."},"warnings":[{"fix":"Use require() instead of import.","message":"Only CommonJS imports are supported; ESM (import) will fail as the package has no default export.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use path.resolve() to ensure absolute paths.","message":"The file list paths must be absolute or relative to the current working directory; otherwise compilation fails silently.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Create a custom .d.ts file if needed.","message":"The package does not include TypeScript type definitions; type checking will be disabled.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"None; designed for simple compilation.","message":"The output is a single string of JavaScript code; there is no AST or source map support.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run npm install wxml-transpiler in the project root.","cause":"The package is not installed or is installed globally but used locally.","error":"Cannot find module 'wxml-transpiler'"},{"fix":"Use createRequire from 'module' or switch to CommonJS.","cause":"Code is running in an ESM context where require is not available.","error":"require is not defined"},{"fix":"Use const { wxmlCompile } = require('wxml-transpiler');","cause":"Incorrect import; the function is not exported as default.","error":"wxmlCompile is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}