{"id":26030,"library":"oc-template-es6-compiler","title":"OC ES6 Template Compiler","description":"Compiles OC (OpenComponents) components using ES6 templates. Version 8.0.0 is the latest stable release. Part of the OpenComponents ecosystem, it provides a compiler for the oc-template-es6 template type. Differentiates from other template compilers by integrating specifically with OC's component architecture. Release cadence follows the OC ecosystem updates.","status":"active","version":"8.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/opencomponents/vite-templates","tags":["javascript","oc","opencomponents","typescript"],"install":[{"cmd":"npm install oc-template-es6-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add oc-template-es6-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add oc-template-es6-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for OC runtime","package":"oc","optional":true}],"imports":[{"note":"ESM-only since v8; use import syntax.","wrong":"const compiler = require('oc-template-es6-compiler')","symbol":"default","correct":"import compiler from 'oc-template-es6-compiler'"},{"note":"TypeScript type export.","symbol":"Compiler","correct":"import { Compiler } from 'oc-template-es6-compiler'"},{"note":"Named function export.","wrong":"const compile = require('oc-template-es6-compiler').compile","symbol":"compile","correct":"import { compile } from 'oc-template-es6-compiler'"},{"note":"TypeScript type import.","symbol":"TemplateType","correct":"import type { TemplateType } from 'oc-template-es6-compiler'"}],"quickstart":{"code":"import compiler from 'oc-template-es6-compiler';\nimport oc from 'oc';\n\nconst component = {\n  type: 'oc-template-es6',\n  view: '<div>Hello {{name}}</div>',\n  model: { name: 'World' }\n};\n\nconst compiled = compiler.compile(component);\nconsole.log(compiled);\n// Output: rendered HTML string","lang":"typescript","description":"Shows how to import and use the compiler to compile an OC ES6 component template."},"warnings":[{"fix":"Replace require() with import statements.","message":"Version 8.0.0 drops CommonJS support; use ESM imports only.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Switch to default import: import compiler from 'oc-template-es6-compiler'.","message":"The 'compile' function will be removed in v9; use 'compiler' default export.","severity":"deprecated","affected_versions":">=7.0.0 <9.0.0"},{"fix":"Install oc as a peer dependency: npm install oc.","message":"Ensure 'oc' runtime is available; otherwise compile will fail silently.","severity":"gotcha","affected_versions":">0.0.0"},{"fix":"Use backtick literals for templates.","message":"Template strings must be valid ES6 syntax; otherwise compiler throws a generic error.","severity":"gotcha","affected_versions":">0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install oc-template-es6-compiler","cause":"Package not installed.","error":"Cannot find module 'oc-template-es6-compiler'"},{"fix":"Use default import: import compiler from 'oc-template-es6-compiler'","cause":"Using named import incorrectly on default export.","error":"compiler.compile is not a function"},{"fix":"Ensure a valid component object is passed.","cause":"Passing undefined or null object to compile.","error":"TypeError: Cannot read properties of undefined (reading 'type')"},{"fix":"Use import syntax and ensure template is a string literal.","cause":"Require() used in ESM-only context or string not using backticks.","error":"SyntaxError: Unexpected token '`'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}