Skip to content

Commit

Permalink
fix: vue add should not crash when executed under Yarn PnP
Browse files Browse the repository at this point in the history
TODO: should fix `loadModule` in PnP environment
  • Loading branch information
haoqunjiang committed Nov 8, 2019
1 parent 26c4899 commit 30f7242
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@vue/cli/lib/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function add (pluginName, options = {}, context = process.cwd()) {

// for `vue add` command in 3.x projects
const servicePkg = loadModule('@vue/cli-service/package.json', context)
if (semver.satisfies(servicePkg.version, '3.x')) {
if (servicePkg && semver.satisfies(servicePkg.version, '3.x')) {
// special internal "plugins"
if (/^(@vue\/)?router$/.test(pluginName)) {
return addRouter(context)
Expand Down

0 comments on commit 30f7242

Please sign in to comment.