glass-easel-template-compiler

raw JSON →
0.19.0 verified Fri May 01 auth: no javascript

A template compiler for the glass-easel framework, a Web Components-based UI library. Version 0.19.0 compiles HTML templates into JavaScript render functions. It is built using Rust and compiled to WebAssembly for Node.js or browser environments. The compiler is tightly coupled with glass-easel core and is not intended for standalone use. Release cadence follows the main glass-easel project, with updates published on npm and GitHub. Key differentiators include WASM-based performance and integration with WeChat's glass-easel ecosystem.

error Cannot find module 'glass-easel-template-compiler'
cause Package not installed or not in node_modules.
fix
Run npm install glass-easel-template-compiler.
error const compile = require('glass-easel-template-compiler'); TypeError: compile is not a function
cause CJS require is not supported; package is ESM-only.
fix
Use import compile from 'glass-easel-template-compiler'.
breaking Default export changed from object to function in v0.19.0.
fix Use default import directly as a function: import compile from 'glass-easel-template-compiler'
gotcha Requires Node.js version >= 14 for WebAssembly support.
fix Upgrade Node.js to >= 14 or use a polyfill.
gotcha The package is only compatible with the glass-easel framework; standalone usage is unsupported.
fix Ensure glass-easel core is installed and configured.
deprecated The CJS build is removed; only ESM is supported.
fix Use ESM imports; do not use require().
npm install glass-easel-template-compiler
yarn add glass-easel-template-compiler
pnpm add glass-easel-template-compiler

Compiles a simple template string into a render function, demonstrating basic usage.

import compile from 'glass-easel-template-compiler';

const result = compile('<div>{{ message }}</div>');
console.log(result);
// { code: 'function render() { ... }', ... }