Registry / web-framework / weex-template-compiler

weex-template-compiler

JSON →
library2.5.16-weex.1jsnpmunverified

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.

npm install weex-template-compiler
INSTALL
IMPORT
SIG · WEEX-TEMPLATE-COMP
W
weex-template-compiler
web-frameworkjavascriptv2.5.16-weex.1
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.

compile
import { compile } from 'weex-template-compiler'
const { compile } = require('weex-template-compiler')
The package provides CommonJS exports by default, but ESM imports also work in Node.js with bundlers.
parseComponent
import { parseComponent } from 'weex-template-compiler'
Exported as a named function, not default. Use carefully as APIs are not documented.
compileToFunctions
import { compileToFunctions } from 'weex-template-compiler'
import compileToFunctions from 'weex-template-compiler'
This is a named export, not a default one. Common mistake is to try default import.

Shows how to compile a simple Weex template string into a render function using the compile method.

const compiler = require('weex-template-compiler'); const template = '<div><text>Hello Weex</text></div>'; const result = compiler.compile(template, { preserveWhitespace: false, weex: true }); console.log(result.render); // Output: render function string for Weex
Debug
Known issues
deprecatedVue 2 reached End of Life on December 31, 2023. This package will not receive updates or security fixes.
fix
Migrate to Vue 3 and use the standard Vue 3 template compiler if targeting Weex (or consider alternative frameworks).
affects: *
gotchaThis 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.
fix
Use 'vue-template-compiler' for web projects; only use 'weex-template-compiler' when building Weex apps.
affects: *
breakingThe '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.
fix
If using an older weex-vue-loader, pin the compiler to version 2.4.x or upgrade both packages together.
affects: 2.5.x
gotchaThe 'parseComponent' API signature differs from Vue's official compiler. It expects a different options object and may not handle all edge cases.
fix
Refer to the source code (src/platforms/weex/entry-compiler.js) for exact API, as documentation is incomplete.
affects: *
deprecatedWeex itself is in maintenance mode and not recommended for new projects. This package is deprecated by extension.
fix
Consider using React Native or Flutter for cross-platform native apps.
affects: *
Errors
Common errors & fixes
Cannot find module 'weex-template-compiler'
Package is not installed or not in node_modules.
fix
Run: npm install weex-template-compiler@2.5.16-weex.1 --save-dev
TypeError: compiler.compile is not a function
Incorrect import: trying to call compile on a default import instead of named import.
fix
Use: const { compile } = require('weex-template-compiler');
Unknown custom element: <text> - did you register the component correctly?
The compiled render function refers to Weex-native components that are not available in a standard Web environment.
fix
Only run this compiled code in a Weex container (e.g., Weex playground, Android/iOS Weex SDK).
Upgrade
Version history
2.5.16-weex.1latest on npm
Audit
Dependencies
vue-template-compileroptionalShares core compilation logic with the standard Vue 2 template compiler; typically installed as a peer dependency.
weex-vue-loaderoptionalThe package is designed to be used alongside weex-vue-loader, which invokes this compiler.
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
weex-template-compiler — npm install weex-template-compiler · libregistry