mirror of
https://github.com/microsoft/vscode.git
synced 2026-10-09 20:02:22 +01:00
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>
39 lines
1.3 KiB
TypeScript
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
|
|
}
|
|
}),
|
|
};
|
|
}
|