8000 Add instruction to build with Angular CLI · iamcsk/plotly.js@b0e9209 · GitHub
[go: up one dir, main page]

Skip to content

Commit b0e9209

Browse files
TomDemulierChevretetpinard
authored andcommitted
Add instruction to build with Angular CLI
1 parent 89aa364 commit b0e9209

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,41 @@ A repo that demonstrates how to build plotly.js with Webpack can be found [here]
122122
...
123123
```
124124

125+
#### Building plotly.js with Angular CLI
126+
127+
Currently Angular CLI use Webpack under the hood to bundle and build your Angular application.
128+
Sadly it doesn't allow to override its Webpack config, and therefore to use the plugin mentioned in [Building plotly.js with Webpack](#building-plotly.js-with-webpack).
129+
Without this plugin your build will fail when it tries to build glslify for GLSL plots.
130+
131+
Currently 2 solutions exists to circumvent this issue :
132+
1) If you need to use GLSL plots, you can create a Webpack config from your Angular CLI projet with [ng eject](https://github.com/angular/angular-cli/wiki/eject).
133+
This will allow you to follow the instructions regarding Webpack.
134+
2) If you don't need to use GLSL plots, you can make a custom build containing only the required modules for your plots.
135+
The clean way to do it with Angular CLI is not the method described in [Modules](#modules) but the following :
136+
```typescript
137+
// in the Component you want to create a graph
138+
import * as Plotly from 'plotly.js';
139+
```
140+
141+
```json
142+
// in src/tsconfig.app.json
143+
...
144+
"compilerOptions": {
145+
...
146+
"paths": {
147+
"plotly.js": [
148+
// List here the modules you want to import
149+
// this exemple is enough for scatter plots
150+
"../node_modules/plotly.js/lib/core.js",
151+
"../node_modules/plotly.js/lib/scatter.js"
152+
]
153+
}
154+
...
155+
}
156+
...
157+
158+
```
159+
125160
## Bugs and feature requests
126161

127162
Have a bug or a feature request? Please first read the [issues guidelines](https://github.com/plotly/plotly.js/blob/master/CONTRIBUTING.md#opening-issues).

0 commit comments

Comments
 (0)
0