Skip to content

build: bundle extension with esbuild#55

Open
tembleking wants to merge 1 commit into
mainfrom
feat/esbuild-bundle
Open

build: bundle extension with esbuild#55
tembleking wants to merge 1 commit into
mainfrom
feat/esbuild-bundle

Conversation

@tembleking

Copy link
Copy Markdown
Member

The extension shipped every tsc-emitted file plus the full node_modules tree in the .vsix (198 files, 361KB). Bundling src/extension.ts into a single minified dist/extension.js with esbuild inlines the runtime deps (all pure JS, vscode left external) and drops node_modules from the package entirely:

Before (tsc) After (esbuild)
.vsix (compressed) 361 KB 75 KB (-79%)
Files 198 7

Faster activation too: the host resolves one module instead of ~190.

tsc is kept for type-checking (--noEmit) and for compiling tests to out/, so test coverage is unaffected. Nix (vsix.nix) already derives deps via importNpmLock, so no hash to maintain; vsce package now runs the esbuild-based vscode:prepublish.

Also fixes a pre-existing ordering-dependent flaky test in highlighters (highlightLayer relied on extension.activate() having run in another test file first, leaving vulnTreeDataProvider undefined otherwise) by stubbing it locally in setup.

Note: the pre-commit lint hook also runs npm audit, which fails on a pre-existing serialize-javascript advisory pulled in via @vscode/test-cli → mocha (no fix available, unrelated to this change). esbuild itself has zero dependencies.

The extension shipped every tsc-emitted file plus the full node_modules tree
in the .vsix (198 files, 361KB). Bundling src/extension.ts into a single
minified dist/extension.js with esbuild inlines the runtime deps (all pure JS)
and drops node_modules from the package: 7 files, 75KB (-79%), with faster
activation since the host resolves one module instead of ~190.

tsc stays for type-checking (--noEmit) and for compiling tests to out/.
Also fixes a pre-existing ordering-dependent flaky test in highlighters
(highlightLayer relied on extension.activate() having run in another test
file first) by stubbing vulnTreeDataProvider locally.
@tembleking tembleking requested a review from a team as a code owner June 29, 2026 15:42
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.

1 participant