Skip to content

Commit

Permalink
chore: make prettier dependency optional
Browse files Browse the repository at this point in the history
closes #84
  • Loading branch information
haoqunjiang committed Apr 8, 2020
1 parent b541fef commit aea1b79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/compileTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ function actuallyCompile(
parser: 'babel'
})
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
tips.push(
'The `prettify` option is on, but the dependency `prettier` is not found.\n' +
'Please either turn off `prettify` or manually install `prettier`.'
)
}
tips.push(
`Failed to prettify component ${options.filename} template source after compilation.`
)
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@
"merge-source-map": "^1.1.0",
"postcss": "^7.0.14",
"postcss-selector-parser": "^6.0.2",
"prettier": "^1.18.2",
"source-map": "~0.6.1",
"vue-template-es2015-compiler": "^1.9.0"
},
"optionalDependencies": {
"prettier": "^1.18.2"
}
}

0 comments on commit aea1b79

Please sign in to comment.