Closed mithi closed 3 years ago
Attempting to reduce bundle size further https://github.com/mithi/hexapod/issues/55
import Plotly from "plotly.js/lib/core";
import Scatter3d from "plotly.js/lib/scatter3d"
import Mesh3d from "plotly.js/lib/mesh3d"
import createPlotlyComponent from "react-plotly.js/factory";
Plotly.register([Scatter3d, Mesh3d]);
const CustomPlotly = createPlotlyComponent(Plotly);
export default CustomPlotly;
When you split the core plotly module from others
import("plotly.js/lib/core").then(Plotly => {
Plotly.register([Scatter3d, Mesh3d])
this.Plot = createPlotlyComponent(Plotly)
})
312.71 KB
and 115.61 KB
. | . |
414kb
bundle this is the performance. | . |
450kb
bundle this is the performance. | . |
. | . | . |
. | . | . |
The best way to reduce bundle size is to use a smaller library such as https://github.com/mithi/bare-minimum-3d
Full discussion in: https://github.com/plotly/plotly.js/issues/5031