{"id":25975,"library":"nativescript-vue-template-compiler","title":"NativeScript-Vue Template Compiler","description":"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.","status":"maintenance","version":"2.9.3","language":"javascript","source_language":"en","source_url":"https://github.com/rigor789/nativescript-vue","tags":["javascript","nativescript-vue","compiler"],"install":[{"cmd":"npm install nativescript-vue-template-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add nativescript-vue-template-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add nativescript-vue-template-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core runtime required for the compiled templates to work","package":"nativescript-vue","optional":false},{"reason":"Core Vue template compiler dependency","package":"vue-template-compiler","optional":false}],"imports":[{"note":"ESM default import. CommonJS require is not supported in modern builds.","wrong":"const compiler = require('nativescript-vue-template-compiler')","symbol":"default","correct":"import compiler from 'nativescript-vue-template-compiler'"},{"note":"Available as a named export in v3+; in v2.x only default export.","wrong":"import compile from 'nativescript-vue-template-compiler'","symbol":"compile","correct":"import { compile } from 'nativescript-vue-template-compiler'"},{"note":"Server-side rendering compiler, only available in v3+.","wrong":"import ssr from 'nativescript-vue-template-compiler'","symbol":"ssrCompile","correct":"import { ssrCompile } from 'nativescript-vue-template-compiler'"}],"quickstart":{"code":"import compiler from 'nativescript-vue-template-compiler';\nimport { compile } from 'nativescript-vue-template-compiler';\n\nconst template = `<Label text=\"Hello, NativeScript!\" />`;\nconst result = compile(template, { preserveWhitespace: false });\nconsole.log(result.render);\n// Use the render function with the NativeScript-Vue runtime\n","lang":"typescript","description":"Demonstrates how to import and use the template compiler to compile a simple NativeScript component template."},"warnings":[{"fix":"Upgrade to Vue 3 and rewrite templates if relying on v2-specific render function format.","message":"v3.0.0 introduces support for scoped styles but requires Vue 3 and breaking changes in template compilation output.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Do not modify the package; contribute changes to the main nativescript-vue repository.","message":"The package is auto-generated; manual changes to the source file `platform/nativescript/compiler` will be overwritten.","severity":"gotcha","affected_versions":"all"},{"fix":"Install both peer dependencies: `npm install nativescript-vue vue-template-compiler`","message":"Template compilation requires both `nativescript-vue` and `vue-template-compiler` as peer dependencies.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Replace `import compiler from '...'` with `import { compile } from '...'` (or other named exports).","message":"The default export `compiler` has been deprecated in favor of named exports like `compile` and `ssrCompile` starting in v3.0.0.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install nativescript-vue-template-compiler` (and its peer dependencies).","cause":"Missing or incorrect package installation.","error":"Module not found: Can't resolve 'nativescript-vue-template-compiler'"},{"fix":"Use `import compiler from '...'` then call `compiler.compile(template, options)`.","cause":"Incorrect import style – using named import on default export in v2.x.","error":"TypeError: compiler.compile is not a function"},{"fix":"Run `npm install vue-template-compiler`.","cause":"Missing peer dependency.","error":"Cannot find module 'vue-template-compiler'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}