diff --git a/esbuild.js b/esbuild.js index 41cfad62f..990278cf4 100644 --- a/esbuild.js +++ b/esbuild.js @@ -116,23 +116,19 @@ async function main() { logLevel: 'info', }); + const contexts = [extensionCtx, agentCtx, interactiveRendererCtx, webviewCtx]; if (watch) { - await Promise.all([ - extensionCtx.watch(), - agentCtx.watch(), - interactiveRendererCtx.watch(), - webviewCtx.watch() - ]); + await Promise.all(contexts.map(context => context.watch())); console.log('Watching for changes...'); } else { - await extensionCtx.rebuild(); - await agentCtx.rebuild(); - await interactiveRendererCtx.rebuild(); - await webviewCtx.rebuild(); - await extensionCtx.dispose(); - await agentCtx.dispose(); - await interactiveRendererCtx.dispose(); - await webviewCtx.dispose(); + try { + const results = await Promise.all(contexts.map(context => context.rebuild())); + if (results.some(result => result.warnings.length > 0)) { + throw new Error('Build failed because esbuild reported warnings.'); + } + } finally { + await Promise.all(contexts.map(context => context.dispose())); + } } } diff --git a/src/helpViewer/helpPreviewer.ts b/src/helpViewer/helpPreviewer.ts index 462f1f990..c8d53cd69 100644 --- a/src/helpViewer/helpPreviewer.ts +++ b/src/helpViewer/helpPreviewer.ts @@ -2,7 +2,7 @@ import * as path from 'path'; import * as fs from 'fs'; import * as vscode from 'vscode'; import * as rHelp from './index'; -import * as ejs from 'ejs'; +import ejs from 'ejs'; import { isDirSafe, isFileSafe, readFileSyncSafe, config, spawnAsync } from '../util'; import { Topic, TopicType } from './packages'; diff --git a/src/plotViewer/httpgdViewer.ts b/src/plotViewer/httpgdViewer.ts index 2e28d4f32..257ac279d 100644 --- a/src/plotViewer/httpgdViewer.ts +++ b/src/plotViewer/httpgdViewer.ts @@ -3,7 +3,7 @@ import { HttpgdClient, HttpgdIdResponse, HttpgdPlotId, HttpgdRendererId } from ' import { HttpgdPlot, IHttpgdViewer, HttpgdViewerOptions } from './httpgdTypes'; import * as path from 'path'; import * as fs from 'fs'; -import * as ejs from 'ejs'; +import ejs from 'ejs'; import { asViewColumn, config, setContext, UriIcon, makeWebviewCommandUriString } from '../util'; import { extensionContext } from '../extension';