Closed ThornDuke closed 6 months ago
Is your extension open-source? Do you have a repo that I can test against?
Is your extension open-source? Do you have a repo that I can test against?
Sure.
The repository is https://github.com/ThornDuke/sams-encryptor.
I got around the problem by adding the line
**/typescript
to .vscodeignore
.
With that line vsce
behaves like this:
# .vscodeignore
**/typescript
# terminal
$ npm run pack
> sams-file-encryptor@1.2.2 pack
> vsce pack --githubBranch master
Executing prepublish script 'npm run vscode:prepublish'...
> sams-file-encryptor@1.2.2 vscode:prepublish
> npm run esbuild-base -- --minify
> sams-file-encryptor@1.2.2 esbuild-base
> esbuild ./src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node --minify
out/main.js 5.2kb
⚡ Done in 5ms
DONE Packaged: /repos/SAMS/SFE/sams-file-encryptor-1.2.2.vsix (17 files, 35.9KB)
35.9KB
However, if I comment out that line vsce
behaves like this:
# .vscodeignore
# **/typescript
# terminal
$ npm run pack
> sams-file-encryptor@1.2.2 pack
> vsce pack --githubBranch master
Executing prepublish script 'npm run vscode:prepublish'...
> sams-file-encryptor@1.2.2 vscode:prepublish
> npm run esbuild-base -- --minify
> sams-file-encryptor@1.2.2 esbuild-base
> esbuild ./src/extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node --minify
out/main.js 5.2kb
⚡ Done in 2ms
DONE Packaged: /repos/SAMS/SFE/sams-file-encryptor-1.2.2.vsix (45 files, 5.18MB)
5.18MB
But my solution is just a workaround. It is not normal to have to add the packages contained in the /node_modules
folder to the .vscodeignore
.
If you comment out the line in the ignore file and run vsce ls
what node modules are included in the VSIX? VSCE will include all dependencies
but exclude devDependencies
btw. Finally, if you end up bundling everything, the suggestion is to simply ignore the entire node_modules
folder.
VSCode 1.86.0, vsce 2.23.0
I'm developing an extension for VSCode.
These are the relevant parts of
package.json
The problem is that when I compile the project (
npm run pack
) the.vsix
file is too large, about 6M, while the "real" code contained in theout/main.js
file is just under 5Kb.I renamed the
.vsix
file to.zip
and opened it and saw that in the.node_modules
folder there is also thetypescrypt
folder, which alone weighs (uncompressed) about 20M.What could be the problem? Why is the
typescript
package bundled into the extension file even though it is part of thedevDependencies
section inpackage.json
?