Skip to content

Clean up esbuilding of extensions#294716

Merged
mjbvz merged 3 commits intomainfrom
dev/mjbvz/more-esbuild-ext-cleanup
Feb 12, 2026
Merged

Clean up esbuilding of extensions#294716
mjbvz merged 3 commits intomainfrom
dev/mjbvz/more-esbuild-ext-cleanup

Conversation

@mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Feb 11, 2026

  • Make sure we still always type check using tsgo --noEmit
  • Align names of esbuild files
  • Convert all esbuild files to typescript. We use the .mts extension to avoid annoying node warnings about using pacakges

- Make sure we still always type check using `tsgo --noEmit`
- Align names of esbuild files
- Convert all esbuild files to typescript. We use the `.mts` extension to avoid annoying node warnings about using pacakges
Copilot AI review requested due to automatic review settings February 11, 2026 22:58
Copy link
Contributor

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 refactors extension esbuild entrypoints and shared esbuild helpers, aiming to standardize filenames, move scripts to TypeScript (.mts), and ensure extension builds are still type-checked via tsgo --noEmit.

Changes:

  • Rename/realign per-extension esbuild scripts (e.g. esbuild.webview.mts, esbuild.notebook.mts) and update package.json scripts accordingly.
  • Introduce shared .mts esbuild helpers (extensions/esbuild-*-common.mts) and update extensions to import them.
  • Update the build pipeline to run a separate tsgo --noEmit typecheck step for esbuild-bundled extensions.

Reviewed changes

Copilot reviewed 26 out of 27 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
extensions/simple-browser/package.json Updates build script to point at new esbuild entrypoint name.
extensions/simple-browser/esbuild.webview.mts Switches shared helper import to .mts.
extensions/notebook-renderers/package.json Updates notebook build script name.
extensions/notebook-renderers/esbuild.notebook.mts Switches shared helper import to .mts.
extensions/mermaid-chat-features/package.json Updates webview build script name.
extensions/mermaid-chat-features/esbuild.webview.mts Switches shared helper import to .mts.
extensions/mermaid-chat-features/esbuild.mts Switches shared helper import to .mts.
extensions/mermaid-chat-features/esbuild.browser.mts Switches shared helper import to .mts.
extensions/media-preview/esbuild.mts Switches shared helper import to .mts.
extensions/media-preview/esbuild.browser.mts Switches shared helper import to .mts.
extensions/markdown-math/tsconfig.browser.json Adds a browser tsconfig for web typechecking.
extensions/markdown-math/package.json Updates build script to .mts.
extensions/markdown-math/esbuild.notebook.mts Switches shared helper import to .mts and adds a typed callback param.
extensions/markdown-math/esbuild.mts Switches shared helper import to .mts.
extensions/markdown-math/esbuild.browser.mts Switches shared helper import to .mts.
extensions/markdown-language-features/tsconfig.browser.json Narrows browser project inputs for web typechecking.
extensions/markdown-language-features/package.json Reworks build/watch scripts and adds explicit web bundle + typecheck commands.
extensions/markdown-language-features/esbuild.webview.mts Switches shared helper import to .mts.
extensions/markdown-language-features/esbuild.notebook.mts Switches shared helper import to .mts.
extensions/markdown-language-features/esbuild.mts Switches shared helper import to .mts.
extensions/markdown-language-features/esbuild.browser.mts Switches shared helper import to .mts.
extensions/ipynb/package.json Updates notebook build script name.
extensions/ipynb/esbuild.notebook.mts Switches shared helper import to .mts.
extensions/esbuild-webview-common.mts Converts webview helper to TS types and exports typed helpers.
extensions/esbuild-extension-common.mts Adds new shared helper for extension bundling with esbuild.
build/lib/tsgo.ts Adds noEmit option so build pipeline can typecheck without emitting.
build/lib/extensions.ts Switches esbuild config filenames to .mts, adds typecheck stream for esbuild builds, and updates media script list.
Comments suppressed due to low confidence (2)

extensions/esbuild-webview-common.mts:8

  • The comment says “used in in webviews” (duplicate “in”). Please fix the wording (e.g. “used in webviews”).
    build/lib/extensions.ts:282
  • fromLocalEsbuild executes the extension’s esbuild.*.mts script via cp.execFile(process.argv[0], [esbuildScript]) (plain node). Since those scripts now import .mts helpers that include TypeScript-only syntax, this invocation will fail unless Node is started with --experimental-strip-types (or another TS loader). Consider adding the flag when invoking .ts/.mts build scripts here.
	const esbuildScript = path.join(extensionPath, esbuildConfigFileName);

	// Run esbuild, then collect the files
	new Promise<void>((resolve, reject) => {
		const proc = cp.execFile(process.argv[0], [esbuildScript], {}, (error, _stdout, stderr) => {
			if (error) {
				return reject(error);
			}

			const matches = (stderr || '').match(/\> (.+): error: (.+)?/g);
			fancyLog(`Bundled extension: ${ansiColors.yellow(path.join(path.basename(extensionPath), esbuildConfigFileName))} with ${matches ? matches.length : 0} errors.`);

@mjbvz mjbvz marked this pull request as ready for review February 12, 2026 02:34
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 12, 2026
@mjbvz mjbvz merged commit 5cc2b2a into main Feb 12, 2026
47 checks passed
@mjbvz mjbvz deleted the dev/mjbvz/more-esbuild-ext-cleanup branch February 12, 2026 03:30
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.

2 participants

Comments