-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Webpack support #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi Buremba, For future use, we try to keep our github issues reserved for found bugs rather than troubleshooting, but I'll be happy to help here this time. It appears that the issue is with the paths you are using, or you are not using an up to date version of plotly.js. To use trace modules, you must be using plotly.js v1.5.0 or greater. I would suggest installing using |
Hey @mdtusz, Sorry for the confusion. I thought that this is an issue because I'm already using v1.5.2 and Webpack is able to find the Plotly files in my configuration. I installed Plotly with Bower and the Bower package is missing some of the dependencies such as I tried to install Plotly with npm as you suggested and point the path the that location in configuration file and now, Webpack is able to find the Plotly modules and its dependencies and bundle them. Thanks! Just another quick question: Currently, the only problem is |
Currently there's no official solution for using an external version of d3 with plotly.js. Because of the api changes in newer versions of d3, we need to maintain a locked version that we can guarantee will work with our code. Injecting the d3 dependency throughout the plotly.js codebase will be a fairly large issue to tackle, so I don't foresee the feature being added in the near future. If you are ok with using the version of d3 shipped with plotly.js (v3.5.12 at the time of writing), we expose d3 on the Hope that helps! |
Ah. That's a shame. |
Plotly is making my bundle pretty huge, adding about 1.2mb. Anyone think that I may be doing something wrong, or know of a work-around for this? |
@mdramos you can now use the individual modules that you need from the // Create a file that will configure your custom bundle - e.g. lean_plotly.js
var Plotly = require('plotly.js/lib/core');
// Load in the trace types you need e.g. pie, and choropleth
Plotly.register([
require('plotly.js/lib/pie'),
require('plotly.js/lib/choropleth')
]);
// Export the custom build
module.exports = Plotly; Then, elsewhere in your code you can require this file and use Plotly as you would normally. https://github.com/plotly/plotly.js#modules |
@mdtusz Thanks, will give it a go! Update |
see https://github.com/plotly/plotly.js/blob/master/README.md#building-plotlyjs-with-webpack for recent instructions |
I tried bundling Plotly with Webpack but couldn't be able to do it. I created a plotly.bundle.js file and added Plotly modules that I need to that custom module.
Then added ify loader using this configuration:
{test: /node_modules/, loader: 'ify'}
When I try to run webpack command it throws this exception:
The text was updated successfully, but these errors were encountered: