Registry / web-framework / nativescript-vue-template-compiler

nativescript-vue-template-compiler

JSON →
library2.9.3jsnpmunverified

Template compiler for NativeScript-Vue, auto-generated from the platform/nativescript/compiler source. Current stable version is 2.9.3 (maintenance) and 3.0.2 (latest). The package is used to compile Vue single-file component templates into render functions optimized for NativeScript's native UI rendering. It is a required dependency for building NativeScript-Vue applications and is automatically included when using the nativescript-vue package. The 3.x series adds support for scoped styles and other improvements but introduces breaking changes if upgrading from 2.x due to Vue version differences. Release cadence is irregular, with major versions aligned with NativeScript and Vue updates.

npm install nativescript-vue-template-compiler
INSTALL
IMPORT
SIG · NATIVESCRIPT-VUE-T
N
nativescript-vue-template-compiler
web-frameworkjavascriptv2.9.3
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 compiler from 'nativescript-vue-template-compiler'
const compiler = require('nativescript-vue-template-compiler')
ESM default import. CommonJS require is not supported in modern builds.
compile
import { compile } from 'nativescript-vue-template-compiler'
import compile from 'nativescript-vue-template-compiler'
Available as a named export in v3+; in v2.x only default export.
ssrCompile
import { ssrCompile } from 'nativescript-vue-template-compiler'
import ssr from 'nativescript-vue-template-compiler'
Server-side rendering compiler, only available in v3+.

Demonstrates how to import and use the template compiler to compile a simple NativeScript component template.

import compiler from 'nativescript-vue-template-compiler'; import { compile } from 'nativescript-vue-template-compiler'; const template = `<Label text="Hello, NativeScript!" />`; const result = compile(template, { preserveWhitespace: false }); console.log(result.render); // Use the render function with the NativeScript-Vue runtime
Debug
Known issues
breakingv3.0.0 introduces support for scoped styles but requires Vue 3 and breaking changes in template compilation output.
fix
Upgrade to Vue 3 and rewrite templates if relying on v2-specific render function format.
affects: >=3.0.0
gotchaThe package is auto-generated; manual changes to the source file `platform/nativescript/compiler` will be overwritten.
fix
Do not modify the package; contribute changes to the main nativescript-vue repository.
affects: all
gotchaTemplate compilation requires both `nativescript-vue` and `vue-template-compiler` as peer dependencies.
fix
Install both peer dependencies: `npm install nativescript-vue vue-template-compiler`
affects: >=2.0.0
deprecatedThe default export `compiler` has been deprecated in favor of named exports like `compile` and `ssrCompile` starting in v3.0.0.
fix
Replace `import compiler from '...'` with `import { compile } from '...'` (or other named exports).
affects: >=3.0.0
Errors
Common errors & fixes
Module not found: Can't resolve 'nativescript-vue-template-compiler'
Missing or incorrect package installation.
fix
Run `npm install nativescript-vue-template-compiler` (and its peer dependencies).
TypeError: compiler.compile is not a function
Incorrect import style – using named import on default export in v2.x.
fix
Use `import compiler from '...'` then call `compiler.compile(template, options)`.
Cannot find module 'vue-template-compiler'
Missing peer dependency.
fix
Run `npm install vue-template-compiler`.
Upgrade
Version history
2.9.3latest on npm
Audit
Dependencies
nativescript-vuerequiredCore runtime required for the compiled templates to work
vue-template-compilerrequiredCore Vue template compiler dependency
Agent activity
2 hits · last 30 days
node
2
Resources
nativescript-vue-template-compiler — npm install nativescript-vue-template-compiler · libregistry