mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
Combine esbuild scripts (#184531)
* Combine esbuild scripts This combines the various build scripts used for building webview/notebook content. This should make it easier to update settings for them As part of this, I also fixed the script so that on watch it restarts automatically on syntax errors instead of exiting * Migrate other build script * Fixing math build script
This commit is contained in:
@@ -4,42 +4,15 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
// @ts-check
|
||||
const path = require('path');
|
||||
const esbuild = require('esbuild');
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
const isWatch = args.indexOf('--watch') >= 0;
|
||||
|
||||
let outputRoot = __dirname;
|
||||
const outputRootIndex = args.indexOf('--outputRoot');
|
||||
if (outputRootIndex >= 0) {
|
||||
outputRoot = args[outputRootIndex + 1];
|
||||
}
|
||||
|
||||
const srcDir = path.join(__dirname, 'preview-src');
|
||||
const outDir = path.join(outputRoot, 'media');
|
||||
const outDir = path.join(__dirname, 'media');
|
||||
|
||||
function build() {
|
||||
return esbuild.build({
|
||||
entryPoints: [
|
||||
path.join(srcDir, 'index.ts'),
|
||||
path.join(srcDir, 'pre'),
|
||||
],
|
||||
bundle: true,
|
||||
minify: true,
|
||||
sourcemap: false,
|
||||
format: 'iife',
|
||||
outdir: outDir,
|
||||
platform: 'browser',
|
||||
target: ['es2020'],
|
||||
});
|
||||
}
|
||||
|
||||
build().catch(() => process.exit(1));
|
||||
|
||||
if (isWatch) {
|
||||
const watcher = require('@parcel/watcher');
|
||||
watcher.subscribe(srcDir, () => {
|
||||
return build();
|
||||
});
|
||||
}
|
||||
require('../esbuild-webview-common').run({
|
||||
entryPoints: [
|
||||
path.join(srcDir, 'index.ts'),
|
||||
path.join(srcDir, 'pre'),
|
||||
],
|
||||
srcDir,
|
||||
outdir: outDir,
|
||||
}, process.argv);
|
||||
|
||||
Reference in New Issue
Block a user