When I was preparing to publish my VS Code extension, vsce
encountered a dependency issue.
Like this:
npm ERR! missing: @sindresorhus/is@^1.0.0, required by [email protected]
npm ERR! missing: @szmarczak/http-timer@^4.0.0, required by [email protected]
npm ERR! missing: @types/cacheable-request@^6.0.1, required by [email protected]
npm ERR! missing: cacheable-lookup@^2.0.0, required by [email protected]
npm ERR! missing: cacheable-request@^7.0.1, required by [email protected]
npm ERR! missing: decompress-response@^5.0.0, required by [email protected]
npm ERR! missing: duplexer3@^0.1.4, required by [email protected]
npm ERR! missing: get-stream@^5.0.0, required by [email protected]
npm ERR! missing: lowercase-keys@^2.0.0, required by [email protected]
npm ERR! missing: mimic-response@^2.0.0, required by [email protected]
npm ERR! missing: p-cancelable@^2.0.0, required by [email protected]
npm ERR! missing: p-event@^4.0.0, required by [email protected]
...
This is probably because the symlinks of pnpm
are not compatible with vsce
, if you use yarn
for dependency installation you don’t encounter similar problems.
I changed my workflows to solve this problem:
- instead of using
vsce
for packaging, usetsup
tsup src/extension.ts --format cjs --external vscode --no-shims
- Use
-no-dependencies
to skip the vsce packaging process when callingvsce
, so it doesn’t have to find dependencies
npx @vscode/vsce publish --no-dependencies