Skip to content

Commit 953a080

Browse files
committed
fix: update .npmrc for pnpm 4
1 parent 5d2c8da commit 953a080

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const {
3434
hasProjectGit,
3535
hasYarn,
3636
hasPnpm3OrLater,
37+
hasPnpmVersionOrLater,
3738
logWithSpinner,
3839
stopSpinner,
3940
exit,
@@ -223,8 +224,12 @@ module.exports = class Creator extends EventEmitter {
223224

224225
// generate a .npmrc file for pnpm, to persist the `shamefully-flatten` flag
225226
if (packageManager === 'pnpm') {
227+
const pnpmConfig = hasPnpmVersionOrLater('4.0.0')
228+
? 'shamefully-hoist=true\n'
229+
: 'shamefully-flatten=true\n'
230+
226231
await writeFileTree(context, {
227-
'.npmrc': 'shamefully-flatten=true\n'
232+
'.npmrc': pnpmConfig
228233
})
229234
}
230235

0 commit comments

Comments
 (0)