Repository navigation
Description
Problem
Running vsce package locally produces a 25.6 MB VSIX instead of the expected ~5–6 MB. The .vscodeignore file is missing exclusion rules for directories that were added to the repo after it was originally written.
The published v0.7.3 release is 5.4 MB. The bloat comes from dev-only directories being included in the package.
Size Breakdown
| Directory / File | Uncompressed Size | Should be in VSIX? | Reason |
|---|---|---|---|
api/node_modules/ |
70 MB | No | Internal API project with its own node_modules — not needed at runtime |
api/ (rest) |
200 KB | No | Source code and config for the API project — bundled into dist/ |
dist/ |
42 MB | No | Dev-mode webpack output from watch tasks (unminified) — CI builds production bundles separately |
docs/ |
4.1 MB | No | Planning docs, analysis docs, release notes drafts |
packages/ |
1.9 MB | No | Source packages (documentdb-constants, shell-runtime, etc.) — already bundled into webpack output |
.config/ |
32 KB | No | Dev configuration |
.devcontainer/ |
8 KB | No | Dev container config |
work-summary.md |
22 KB | No | Dev notes |
progress.md |
8 KB | No | Dev notes |
extension.bundle.ts |
~1 KB | No | Dev entry point |
Total unnecessary content: ~118 MB uncompressed → ~20 MB compressed
What to Add to .vscodeignore
# Dev-only directories added after initial .vscodeignore creation
api/**
docs/**
packages/**
dist/**
.config/**
.devcontainer/**
# Dev notes and working files
work-summary.md
progress.md
extension.bundle.ts
main.ts
Notes on each exclusion
-
api/**: Theapi/directory is a separate Node.js project for the extension's public API. It has its ownnode_modules/(70 MB!),package-lock.json, and source files. The built output is consumed by the extension at build time, not at runtime. The CI pipeline'svscode:prepublishscript handles this. -
dist/**: Thedist/directory contains webpack dev-mode output from the watch tasks (npm run watch:ext/npm run watch:views). These are unminified bundles (20 MBmain.jsvs 7.2 MB minified). The CI build produces production bundles with a different output path. Includingdist/in localvsce packagemeans shipping unminified dev code. -
docs/**: Planning documents (docs/plan/), architecture analysis (docs/analysis/), release notes drafts (docs/release-notes/). None are needed in the shipped extension. -
packages/**: Monorepo packages (documentdb-constants,documentdb-shell-runtime,schema-analyzer,documentdb-shell-api-types). Their code is bundled into the webpack output — the source packages aren't needed at runtime. -
.config/,.devcontainer/: Development environment configuration. -
work-summary.md,progress.md,extension.bundle.ts,main.ts: Working files and TypeScript sources that shouldn't be shipped.
Verification Steps
After updating .vscodeignore:
- Run
npx vsce ls --treeto verify excluded files don't appear - Run
npx vsce packageand check the VSIX size (should be ~5–6 MB) - Unzip the VSIX and verify only the expected files are present:
main.js(orout/if not using webpack locally)l10n/bundle.l10n.jsonresources/(icons, images)package.json,package.nls.jsonREADME.md,CHANGELOG.md,LICENSE.mdplayground-language-configuration.jsonsyntaxes/
- Install the VSIX locally and verify the extension loads correctly
Bonus: Webpack Bundle Size Analysis
While the VSIX bloat is from missing .vscodeignore entries, the webpack bundles themselves have grown. For reference, the top packages by size across all bundles:
| Package | Size (minified) | Bundle | Notes |
|---|---|---|---|
@azure/arm-network |
3.6 MB | main.js | Pre-existing Azure SDK dependency |
caniuse-lite |
2.2 MB | main.js | Browserlist data — could potentially be tree-shaken |
@azure/arm-compute |
1.7 MB | main.js | Pre-existing Azure SDK dependency |
mongodb |
1.1 MB | main.js + worker | Driver — expected |
@azure/arm-cosmosdb |
1.0 MB | main.js | Pre-existing Azure SDK dependency |
@tootallnate/quickjs-emscripten |
0.7 MB | playgroundWorker.js | @mongosh dependency (WASM) |
@mongosh/shell-api |
0.6 MB | playgroundWorker.js | Shell eval engine |
The playgroundWorker.js bundle (6.9 MB minified) is new — it's the @mongosh eval worker added for the Query Playground and Interactive Shell features. This size is expected given the @mongosh dependency tree.
Reducing bundle sizes further (e.g., tree-shaking caniuse-lite, analyzing Azure SDK imports) is a separate optimization effort.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity