Skip to content

fix: pack fails in monorepo due to duplicate files#1186

Open
yuzheng14 wants to merge 1 commit intomicrosoft:mainfrom
yuzheng14:fix/duplicate-file
Open

fix: pack fails in monorepo due to duplicate files#1186
yuzheng14 wants to merge 1 commit intomicrosoft:mainfrom
yuzheng14:fix/duplicate-file

Conversation

@yuzheng14
Copy link
Copy Markdown

When running vsce pack or vsce ls in a monorepo or workspace setup, duplicate files may appear in the packaged file list leading to pack fail.

image

This is because the internal dependency collection uses the output of:

npm list --production --parseable --depth=99999 --loglevel=error
image

However, this command always includes the project root directory as the first line of its output. As a result, when we later glob for files in each dependency directory, the root directory is also globbed, causing all files (including those in subdirectories like node_modules in sub packages) to be collected multiple times.

vscode-vsce/src/package.ts

Lines 1671 to 1675 in 294d71b

const promises = deps.map(dep =>
glob('**', { cwd: dep, nodir: true, follow: followSymlinks, dot: true, ignore: 'node_modules/**' }).then(files =>
files.map(f => path.relative(cwd, path.join(dep, f))).map(f => f.replace(/\\/g, '/'))
)
);

You can reproduce this at yuzheng14/valype (temporarily it would exist in feat/vscode-extension branch only).

Fixes #812

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant