{"id":26654,"library":"weex-template-compiler","title":"Weex Template Compiler for Vue 2","description":"This is the Weex template compiler for Vue 2.0, used internally by weex-vue-loader to compile .vue files into Weex-compatible JavaScript bundles. The package is auto-generated from the Vue 2 source and is no longer actively maintained. It supports only Vue 2 (EOL December 2023) and does not work with Vue 3. The compiler produces render functions optimized for Weex's native rendering engine. Compared to the standard Vue template compiler, this version adds Weex-specific directives and component handling. Current version is 2.5.16-weex.1, and there have been no updates since Vue 2 entered maintenance mode.","status":"deprecated","version":"2.5.16-weex.1","language":"javascript","source_language":"en","source_url":"https://github.com/vuejs/vue","tags":["javascript","vue","compiler"],"install":[{"cmd":"npm install weex-template-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add weex-template-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add weex-template-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Shares core compilation logic with the standard Vue 2 template compiler; typically installed as a peer dependency.","package":"vue-template-compiler","optional":true},{"reason":"The package is designed to be used alongside weex-vue-loader, which invokes this compiler.","package":"weex-vue-loader","optional":true}],"imports":[{"note":"The package provides CommonJS exports by default, but ESM imports also work in Node.js with bundlers.","wrong":"const { compile } = require('weex-template-compiler')","symbol":"compile","correct":"import { compile } from 'weex-template-compiler'"},{"note":"Exported as a named function, not default. Use carefully as APIs are not documented.","wrong":null,"symbol":"parseComponent","correct":"import { parseComponent } from 'weex-template-compiler'"},{"note":"This is a named export, not a default one. Common mistake is to try default import.","wrong":"import compileToFunctions from 'weex-template-compiler'","symbol":"compileToFunctions","correct":"import { compileToFunctions } from 'weex-template-compiler'"}],"quickstart":{"code":"const compiler = require('weex-template-compiler');\nconst template = '<div><text>Hello Weex</text></div>';\nconst result = compiler.compile(template, {\n  preserveWhitespace: false,\n  weex: true\n});\nconsole.log(result.render);\n// Output: render function string for Weex","lang":"javascript","description":"Shows how to compile a simple Weex template string into a render function using the compile method."},"warnings":[{"fix":"Migrate to Vue 3 and use the standard Vue 3 template compiler if targeting Weex (or consider alternative frameworks).","message":"Vue 2 reached End of Life on December 31, 2023. This package will not receive updates or security fixes.","severity":"deprecated","affected_versions":"*"},{"fix":"Use 'vue-template-compiler' for web projects; only use 'weex-template-compiler' when building Weex apps.","message":"This compiler is tightly coupled to Weex and produces code that only runs in a Weex environment. It cannot be used for standard web or Node.js rendering.","severity":"gotcha","affected_versions":"*"},{"fix":"If using an older weex-vue-loader, pin the compiler to version 2.4.x or upgrade both packages together.","message":"The 'compile' function output format changed between Vue 2.4 and 2.5. Developers using version 2.5.16-weex.1 must ensure their weex-vue-loader is compatible.","severity":"breaking","affected_versions":"2.5.x"},{"fix":"Refer to the source code (src/platforms/weex/entry-compiler.js) for exact API, as documentation is incomplete.","message":"The 'parseComponent' API signature differs from Vue's official compiler. It expects a different options object and may not handle all edge cases.","severity":"gotcha","affected_versions":"*"},{"fix":"Consider using React Native or Flutter for cross-platform native apps.","message":"Weex itself is in maintenance mode and not recommended for new projects. This package is deprecated by extension.","severity":"deprecated","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: npm install weex-template-compiler@2.5.16-weex.1 --save-dev","cause":"Package is not installed or not in node_modules.","error":"Cannot find module 'weex-template-compiler'"},{"fix":"Use: const { compile } = require('weex-template-compiler');","cause":"Incorrect import: trying to call compile on a default import instead of named import.","error":"TypeError: compiler.compile is not a function"},{"fix":"Only run this compiled code in a Weex container (e.g., Weex playground, Android/iOS Weex SDK).","cause":"The compiled render function refers to Weex-native components that are not available in a standard Web environment.","error":"Unknown custom element: <text> - did you register the component correctly?"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}