Registry / devops / vue-prettier

vue-prettier

JSON →
library0.2.0jsnpmunverified

vue-prettier (v0.2.0) is a CLI tool to format .vue single-file components using Prettier. It parses Vue template, script, and style sections individually via vue-template-compiler rather than regex, enabling reliable formatting. Designed as a temporary solution until native Prettier Vue support arrived (which it now has). The package uses the same CLI arguments as Prettier, allowing drop-in replacement. Requires Node >=8 and vue-template-compiler as a peer dependency. Project has seen no updates since 2019 and is effectively superseded by Prettier's built-in Vue support (via @prettier/plugin-vue) since Prettier v1.15+.

npm install vue-prettier
INSTALL
IMPORT
SIG · VUE-PRETTIER
V
vue-prettier
devopsjavascriptv0.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CLI as vue-prettier
const vuePrettier = require('vue-prettier');
vue-prettier is primarily a CLI tool. For programmatic use, the package exports an object with a formatFile function. CommonJS only.
formatFile
const { formatFile } = require('vue-prettier');
import { formatFile } from 'vue-prettier';
The package does not ship ES modules; use CommonJS require.
default
const vuePrettier = require('vue-prettier').default;
import vuePrettier from 'vue-prettier';
There is no default export in the CommonJS module.

Demonstrates using the formatFile function to prettify a .vue file programmatically. Note: CLI is the primary use case.

// Save as format.vue and run: node format.vue const { formatFile } = require('vue-prettier'); const fs = require('fs'); const source = fs.readFileSync('component.vue', 'utf8'); formatFile(source, { parser: 'vue' }).then(result => { console.log(result.formatted); }).catch(err => { console.error(err); });
vue-prettier --version
Debug
Known issues
deprecatedvue-prettier is deprecated; Prettier now natively supports Vue via @prettier/plugin-vue.
fix
Use Prettier >=1.15 with the Vue plugin or Prettier >=2.0 which includes built-in Vue support.
affects: *
breakingPackage requires vue-template-compiler as a peer dependency; missing it causes runtime errors.
fix
Run: npm install --save-dev vue-template-compiler
affects: *
gotchaCLI executable is named 'vue-prettier', not 'prettier'. If used as a drop-in replacement, scripts referencing 'prettier' will not work.
fix
Update scripts to use 'vue-prettier' command, or symlink.
affects: *
gotchaNo Windows support; only tested on Unix-like systems.
fix
Consider using WSL or another tool on Windows.
affects: *
deprecatedProject was last updated in 2019; no longer maintained.
fix
Switch to Prettier's native Vue support.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'vue-template-compiler'
Missing peer dependency vue-template-compiler
fix
npm install --save-dev vue-template-compiler
TypeError: formatFile is not a function
Incorrect import (ESM import on CommonJS package)
fix
Use const { formatFile } = require('vue-prettier');
Error: ENOENT: no such file or directory, open 'component.vue'
File path is incorrect or file does not exist
fix
Ensure the file path is correct relative to the working directory.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
vue-template-compilerrequiredpeer dependency for parsing .vue files
Agent activity
8 hits · last 30 days
node
8
Resources
vue-prettier — npm install vue-prettier · libregistry