diff --git a/src/sql/workbench/parts/backup/browser/backup.module.ts b/src/sql/workbench/parts/backup/browser/backup.module.ts index 3d6c8b987b..9664f74487 100644 --- a/src/sql/workbench/parts/backup/browser/backup.module.ts +++ b/src/sql/workbench/parts/backup/browser/backup.module.ts @@ -17,9 +17,6 @@ import { BackupComponent } from 'sql/workbench/parts/backup/browser/backup.compo import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IBootstrapParams, ISelector } from 'sql/platform/bootstrap/common/bootstrapParams'; -// work around -const BrowserAnimationsModule = (require.__$__nodeRequire('@angular/platform-browser/animations')).BrowserAnimationsModule; - // Backup wizard main angular module export const BackupModule = (params: IBootstrapParams, selector: string, instantiationService: IInstantiationService): Type => { @NgModule({ @@ -30,8 +27,7 @@ export const BackupModule = (params: IBootstrapParams, selector: string, instant imports: [ FormsModule, CommonModule, - BrowserModule, - BrowserAnimationsModule, + BrowserModule ], providers: [ { provide: APP_BASE_HREF, useValue: '/' }, diff --git a/src/sql/workbench/parts/notebook/browser/outputs/plotlyOutput.component.ts b/src/sql/workbench/parts/notebook/browser/outputs/plotlyOutput.component.ts index d73a1c9353..185f9c7570 100644 --- a/src/sql/workbench/parts/notebook/browser/outputs/plotlyOutput.component.ts +++ b/src/sql/workbench/parts/notebook/browser/outputs/plotlyOutput.component.ts @@ -17,8 +17,8 @@ import { getErrorMessage } from 'vs/base/common/errors'; type ObjectType = object; interface FigureLayout extends ObjectType { - width?: string | number; - height?: string; + width?: number; + height?: number; autosize?: boolean; } @@ -43,14 +43,7 @@ declare class PlotlyHTMLElement extends HTMLDivElement { export class PlotlyOutputComponent extends AngularDisposable implements IMimeComponent, OnInit { public static readonly SELECTOR: string = 'plotly-output'; - Plotly!: { - newPlot: ( - div: PlotlyHTMLElement | null | undefined, - data: object, - layout: FigureLayout - ) => void; - redraw: (div?: PlotlyHTMLElement) => void; - }; + private static Plotly?: Promise; @ViewChild('output', { read: ElementRef }) private output: ElementRef; @@ -88,7 +81,9 @@ export class PlotlyOutputComponent extends AngularDisposable implements IMimeCom } ngOnInit() { - this.Plotly = require.__$__nodeRequire('plotly.js-dist'); + if (!PlotlyOutputComponent.Plotly) { + PlotlyOutputComponent.Plotly = import('plotly.js-dist'); + } this._plotDiv = this.output.nativeElement; this.renderPlotly(); this._initialized = true; @@ -116,11 +111,9 @@ export class PlotlyOutputComponent extends AngularDisposable implements IMimeCom // Workaround: to avoid filling up the entire cell, use plotly's default figure.layout.width = Math.min(700, this._plotDiv.clientWidth); } - try { - this.Plotly.newPlot(this._plotDiv, figure.data, figure.layout); - } catch (error) { - this.displayError(error); - } + PlotlyOutputComponent.Plotly.then(plotly => { + return plotly.newPlot(this._plotDiv, figure.data, figure.layout); + }).catch(e => this.displayError(e)); } this._rendered = true; }