A standalone Vue single-file component (SFC) compiler for projects that cannot use webpack. Current stable version is 4.2.1, released on an irregular cadence by a community maintainer. Unlike official vue-loader, this package compiles .vue files directly to CommonJS modules without requiring webpack, supporting both async (compile) and sync (compileSync) APIs. It includes template compilation (via vue-template-compiler), style processing, and custom compiler hooks. However, the package is not actively maintained by the Vue core team and relies on an outdated peer dependency of vue-template-compiler ^2.6.10, meaning it only supports Vue 2.x. For Vue 3, use @vue/compiler-sfc instead.
npm install vue-compilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates async compilation of a Vue single-file component string to a CommonJS module.
Use @vue/compiler-sfc for Vue 3 projects.
Update your project's vue-template-compiler to a newer patch within 2.6.x, or migrate to Vue 3.
Use `import compile from 'vue-compiler'` for the async function.
Add a .d.ts file: `declare module 'vue-compiler'` or use @types/vue-compiler if available.
Run `npm install vue-template-compiler@^2.6.10` in your project.
Use `import compile from 'vue-compiler'` instead of `import { compile } from 'vue-compiler'`.Ensure you have vue-template-compiler@^2.6.10 installed, not @vue/compiler-sfc.