Skip to content

Commit 30f7242

Browse files
committed
fix: vue add should not crash when executed under Yarn PnP
TODO: should fix `loadModule` in PnP environment
1 parent 26c4899 commit 30f7242

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/@vue/cli/lib/add.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async function add (pluginName, options = {}, context = process.cwd()) {
2020

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

0 commit comments

Comments
 (0)