Registry / devops / oc-template-vue-compiler

oc-template-vue-compiler

JSON →
library4.0.1jsnpmunverified

Compiler for Vue.js components in the OpenComponents (OC) ecosystem, enabling server-side rendering and client-side hydration of Vue.js templates. Current stable version is 4.0.1, with updates aligned to OC's release cadence. Key differentiator: integrates tightly with OC's component lifecycle and registry, supporting Vue.js 3.x via @vue/compiler-ssr. Unlike generic Vue builds, this package transforms components into OC-compatible format for server-side compilation.

npm install oc-template-vue-compiler
INSTALL
IMPORT
SIG · OC-TEMPLATE-VUE-CO
O
oc-template-vue-compiler
devopsjavascriptv4.0.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.

default
import compile from 'oc-template-vue-compiler'
const compile = require('oc-template-vue-compiler')
Package exports a default function via ESM. CJS require() works but is not recommended for TypeScript.
compile
import { compile } from 'oc-template-vue-compiler'
import { compile as ocCompile } from 'oc-template-vue-compiler'
Named export 'compile' is equivalent to default export; available for destructuring since v4.
CompiledTemplate
import type { CompiledTemplate } from 'oc-template-vue-compiler'
import { CompiledTemplate } from 'oc-template-vue-compiler'
Type-only export; must be imported with 'type' keyword in TypeScript to avoid runtime issues.

Shows how to import and use the default compile function to compile a Vue.js template file.

import compile from 'oc-template-vue-compiler'; import { promises as fs } from 'fs'; async function compileVueTemplate() { const templateSource = await fs.readFile('./component.vue', 'utf8'); const compiled = compile(templateSource, { templateEngine: 'vue3', oc: { components: {} }, publishMode: false }); console.log('Compiled template:', compiled); } compileVueTemplate().catch(console.error);
Debug
Known issues
breakingIn v4, the compile function now returns a promise instead of synchronous result.
fix
Use async/await or .then() on the return value.
affects: >=4.0.0
deprecatedThe option `templateEngine` is deprecated; use `vueVersion` instead.
fix
Replace `templateEngine: 'vue3'` with `vueVersion: 3`.
affects: >=4.0.0
gotchaThe compiler requires @vue/compiler-ssr to be installed as a peer dependency.
fix
Run: npm install @vue/compiler-ssr
affects: >=4.0.0
gotchaTypeScript types are declared but not exported correctly in v4.0.0; see GitHub issue #12.
fix
Upgrade to v4.0.1 or add custom type declarations.
affects: =4.0.0
Errors
Common errors & fixes
Cannot find module '@vue/compiler-ssr'
Missing peer dependency.
fix
Install @vue/compiler-ssr: npm install @vue/compiler-ssr
compile is not a function
Incorrect import style (e.g., using named import for default export).
fix
Use import compile from 'oc-template-vue-compiler'
Cannot use import statement outside a module
CommonJS project without ESM support.
fix
Use const compile = require('oc-template-vue-compiler').default or set type: module in package.json
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
@vue/compiler-ssrrequiredRequired to compile Vue.js templates for server-side rendering.
Agent activity
2 hits · last 30 days
node
2
Resources
oc-template-vue-compiler — npm install oc-template-vue-compiler · libregistry