Optimize extension package size by bundling dependencies#45
Optimize extension package size by bundling dependencies#45siddharthkp merged 4 commits intomainfrom
Conversation
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>
There was a problem hiding this comment.
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
noExternaloption - Moved all runtime dependencies to devDependencies since they're now bundled at build time
- Updated
.vscodeignoreto 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.
| "vscode-languageserver": "9.0.1", | ||
| "vscode-languageserver-textdocument": "1.0.12" | ||
| }, | ||
| "dependencies": {}, |
There was a problem hiding this comment.
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).
Changes
tsup.config.tsto bundle all dependencies into dist files usingnoExternaloption.vscodeignoreto excludenode_modules/**and build artifactsImpact
node_modulesin package (previously 47.61 MB)The bundled JavaScript files are ~10 MB uncompressed but compress to 674 KB in the
.vsixpackage. All theme data and dependencies are now inlined at build time.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.