Skip to content

Commit 859d43a

Browse files
committed
Removing plotly-via-window.module
1 parent 3d7cfe1 commit 859d43a

File tree

4 files changed

+1
-73
lines changed

4 files changed

+1
-73
lines changed

README.md

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Supports Angular 9.x and up. If you want to use with Angular 8.x, please use ver
2929
* [Event handler props](#event-handler-props)
3030
* [Customizing the `plotly.js` bundle](#customizing-the-plotlyjs-bundle)
3131
* [Plotly Via CDN Module](#plotly-via-cdn-module)
32-
* [Plotly Via Window Module](#plotly-via-window-module)
3332
* [Development](#development)
3433

3534
## Installation
@@ -190,7 +189,7 @@ in front of any plotly-generated elements. This could be useful for implementing
190189

191190
By default, this library bundles `plotly.js` from the peer dependency together within the output. This results on huge outputs, for `plotly.js` itself is ~3MB when bundled. It also makes the build (with `ng serve --prod`) really slow, for it minifies everything together.
192191

193-
If you wish to optimize loading `plotly.js` in a different way, please check both [`PlotlyViaCDNModule`](#plotly-via-cdn-module) and [`PlotlyViaWindowModule`](#plotly-via-window-module) modules below.
192+
If you wish to optimize loading `plotly.js` in a different way, please check the [`PlotlyViaCDNModule`](#plotly-via-cdn-module) module below.
194193

195194

196195
### Plotly Via CDN Module
@@ -232,50 +231,6 @@ PlotlyViaCDNModule.loadViaCDN('custom', 'https://custom.cdn/url'); // can be use
232231
...
233232
```
234233

235-
### Plotly Via Window Module
236-
237-
`plotly.js` can be added as a [global script on angular.json](https://github.com/angular/angular-cli/wiki/stories-global-scripts#global-scripts) to avoid it being bundled into the final project's code. To make this happen, you must first add `plotly.js` path into `angular.json` file as shown below:
238-
239-
```javascript
240-
// angular.json
241-
{
242-
...
243-
"projects": {
244-
"project-name": { // This is your project's name
245-
...
246-
"architect": {
247-
"build": {
248-
...
249-
"options": {
250-
"scripts": [
251-
"node_modules/plotly.js-dist-min/plotly.min.js" // add this
252-
]
253-
}
254-
}
255-
}
256-
...
257-
}
258-
}
259-
}
260-
```
261-
262-
This will include `plotly.js` into the `vendor.js` file generated by angular CLI build process, and `plotly.js` library will be loaded before angular and your project's code. The `window.Plotly` will be available. Thus, you must use `PlotlyViaWindowModule` module to force `angular-plotly.js` to use `window.Plotly` object:
263-
264-
265-
```typescript
266-
import { NgModule } from '@angular/core';
267-
import { CommonModule } from '@angular/common';
268-
269-
import { PlotlyViaWindowModule } from 'angular-plotly.js';
270-
271-
@NgModule({
272-
imports: [CommonModule, PlotlyViaWindowModule],
273-
...
274-
})
275-
export class AppModule { }
276-
```
277-
278-
If you want to use a [different precompiled bundle](https://github.com/plotly/plotly.js/blob/master/dist/README.md#partial-bundles) or if you wish to [assemble you own customized bundle](https://github.com/plotly/plotly.js#modules), you can use `PlotlyViaWindowModule` to force the use of `window.Plotly` object as shown above.
279234

280235
## Development
281236

projects/demo_app/src/app/app.module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { NgModule } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
33

44

5-
import { PlotlyViaWindowModule } from 'projects/plotly/src/lib/plotly-via-window.module';
65

76
import { AppComponent } from './app.component';
87

@@ -12,7 +11,6 @@ import { AppComponent } from './app.component';
1211
],
1312
imports: [
1413
BrowserModule,
15-
PlotlyViaWindowModule
1614
],
1715
providers: [],
1816
bootstrap: [AppComponent]

projects/plotly/src/lib/plotly-via-window.module.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

projects/plotly/src/public-api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
export * from './lib/plotly.module';
66
export * from './lib/plotly-via-cdn.module';
7-
export * from './lib/plotly-via-window.module';
87
export * from './lib/plotly-shared.module';
98

109
export * from './lib/plotly.service';

0 commit comments

Comments
 (0)