Skip to content

Optimize extension package size by bundling dependencies#45

Merged
siddharthkp merged 4 commits intomainfrom
copilot/optimize-vscode-extension-size
Dec 13, 2025
Merged

Optimize extension package size by bundling dependencies#45
siddharthkp merged 4 commits intomainfrom
copilot/optimize-vscode-extension-size

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 12, 2025

Version Packed Unpacked
main 3.1M 53M
branch 675K todo

Changes

  • Created tsup.config.ts to bundle all dependencies into dist files using noExternal option
  • Moved dependencies to devDependencies - runtime dependencies no longer needed since everything is bundled
  • Updated .vscodeignore to exclude node_modules/** and build artifacts

Impact

  • Package size: 3.07 MB → 674 KB (78% reduction)
  • File count: 650 files → 7 files
  • No node_modules in package (previously 47.61 MB)

The bundled JavaScript files are ~10 MB uncompressed but compress to 674 KB in the .vsix package. All theme data and dependencies are now inlined at build time.

Original prompt

Can you optimise the package vscode extension for size


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 12, 2025 17:43
Co-authored-by: siddharthkp <1863771+siddharthkp@users.noreply.github.com>
…ules

- Created tsup.config.ts to bundle all dependencies into dist files
- Moved all dependencies to devDependencies (none needed at runtime)
- Updated .vscodeignore to exclude node_modules and build artifacts
- Enabled treeshaking for better optimization
- Package size reduced from 3.07 MB to 674.73 KB (~78% reduction)
- File count reduced from 650 files to 7 files

Co-authored-by: siddharthkp <1863771+siddharthkp@users.noreply.github.com>
- Use more specific regex pattern for lodash packages (/^lodash\./)
- Clarify comment about code splitting for CommonJS
- Add comment explaining noExternal bundling purpose

Co-authored-by: siddharthkp <1863771+siddharthkp@users.noreply.github.com>
Copilot AI changed the title [WIP] Optimize package size of VSCode extension Optimize extension package size by bundling dependencies Dec 12, 2025
Copilot AI requested a review from siddharthkp December 12, 2025 17:56
@siddharthkp siddharthkp marked this pull request as ready for review December 13, 2025 13:29
Copilot AI review requested due to automatic review settings December 13, 2025 13:29
@siddharthkp siddharthkp merged commit 5f34827 into main Dec 13, 2025
9 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes the VS Code extension package size by bundling all dependencies at build time, reducing the package from 3.1 MB to 675 KB (78% reduction) and eliminating the need to ship node_modules in the extension package.

  • Created a tsup configuration to bundle all dependencies using the noExternal option
  • Moved all runtime dependencies to devDependencies since they're now bundled at build time
  • Updated .vscodeignore to exclude node_modules and build artifacts from the packaged extension

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
tsup.config.ts New bundling configuration that bundles dependencies into CommonJS format with tree-shaking and minification
package.json Moved runtime dependencies to devDependencies and simplified build script to use tsup config file
package-lock.json Updated version number (needs regeneration to match new dependency structure)
.vscodeignore Added exclusions for node_modules and tsup config to prevent shipping unnecessary files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json
"vscode-languageserver": "9.0.1",
"vscode-languageserver-textdocument": "1.0.12"
},
"dependencies": {},
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The postcss package is missing from dependencies. The code in src/language-server.ts imports and uses postcss.parse() at runtime, but postcss is not listed in either dependencies or devDependencies. This will cause the extension to fail when bundled since tsup won't be able to resolve and bundle this dependency.

Add postcss to devDependencies (since all dependencies are now bundled).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants