Files
vscode/build/next/bundle.ts
T
Dmitriy VasyuraandCopilot b51b1b0b04 Remove redundant tslib bundle injection (#336122)
build: remove redundant tslib bundle injection

Let esbuild emit only the helpers needed by direct-from-TypeScript ESM bundles instead of appending the full unminified tslib library.

Share entry and bootstrap options with regression tests for helper behavior, export isolation, licensing, and source maps. Preserve the legacy compiler and unrelated resource processing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-14 12:13:25 +00:00

39 lines
1.3 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import type * as esbuild from 'esbuild';
const fileHeader = `/*!--------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/`;
export function getBundleOptions(minify: boolean, platform: 'neutral' | 'node'): esbuild.BuildOptions {
return {
bundle: true,
format: 'esm',
platform,
target: ['es2024'],
packages: 'external',
sourcemap: 'linked',
sourcesContent: true,
minify,
treeShaking: true,
// esbuild emits and scopes the helpers needed by each input. Keep executable
// code out of banners, which esbuild cannot tree-shake, minify, or rename.
banner: { js: fileHeader, css: fileHeader },
write: false,
logLevel: 'warning',
logOverride: {
'unsupported-require-call': 'silent',
},
tsconfigRaw: JSON.stringify({
compilerOptions: {
experimentalDecorators: true,
useDefineForClassFields: false
}
}),
};
}