-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
Problem with Gulp "Cannot find module" #93
Comments
Can you share a link to a repo or example that shows this problem? As it stands right now I don't have enough information to help you :) |
I am using this gulpfile: https://gist.github.com/kristian2x/5a590446c6f94751a8ff8e5e8f1193b7
The complete error I get is:
Let me know if you need anything else. |
I'm running into the same issue trying to import the module in a Browserify bundle. It's trying to lookup inexistent files in the |
Interestingly it bundles as expected when I create the component myself from plotly by doing: import createPlotlyComponent from 'react-plotly.js/factory';
import Plotly from 'plotly.js';
const Plot = createPlotlyComponent(Plotly); |
@m90 Thanks for your help but unfortunately I am getting the same error even when I try it with |
Hi devs, The problem is that plotly.js pkg name changed. Look how to install the pkg. https://www.npmjs.com/package/plotly.js Do this @nicolaskruchten Please include this fix. Thanks |
I looked further into this and it seems to be an issue with plotly.js itself and the way it is being bundled. Browserify is not able to use the |
I filed an issue in the main repo: plotly/plotly.js#2902 |
OK so it seems from the reports here like there's an issue when using Browserify and importing directly from To me, the factory is the best solution in almost all cases because it allows you full control over the plotly.js bundle that's being used, so you don't have to pay the download-size cost of the full bundle if you just want bar charts. I would say that my official recommendation is to load up a version of plotly.js that works for your build system and pass it to the factory. If we have to choose a set of defaults that works with either Browserify or Webpack, I would be inclined to go the Webpack route, based on my understanding of the relative use-share of these tools in the React community. That said, if merging #94 (basically having the defaults load from |
this should now be resolved with plotly.js 1.40.0. Can someone confirm please? |
I can confirm this is working for me now. Thank you! |
I can also confirm that it works as expected when bundling with Browserify when you depend on Should this: Line 65 in 6fe45a7
-dist now?
|
@nicolaskruchten while it's working my bundled JS file now has increased by around 10mbs! @m90 Do you have the same issue? |
@kristian2x My bundle has always been humongous, so I did not pay too much attention (yet). The version of plotly that react-plotly pulls in is 5.7MB non-minified (and hasn't really changed between 1.39.4 and 1.40.0), which makes me wonder how you accumulate 10MB. How did you import |
@m90 I couldn't import it at all before the fix. You can have a look at my gulp file here: https://gist.github.com/kristian2x/5a590446c6f94751a8ff8e5e8f1193b7 (vendors.js is the file that increases around 10mbs and I don't know why it's that much). In react I import it the same way as stated in the docs (not the factory approach): https://plot.ly/javascript/react/ |
@kristian2x I didn't dig too deep into it, but from a quick glance at your gulpfile I would assume that you are including plotly twice because of the following:
I would assume that simply removing |
@m90 I really appreciate your effort Fredrik unfortunately though this did not solve the issue. I will have a closer look at my gulpfile and I guess this is a problem on my side. Thanks |
FWIW, I just double checked on the project that had me run into the original issue, and if I use |
@kristian2x Btw, a cool tool for debugging size issues w/ Browserify is discify, maybe that gives you some insight on where the bloat is coming from in the first place. |
I am trying to use react plotly but when gulp is bundling all files I get the following error:
Error: Cannot find module './core' from 'C:\Users\...\node_modules\plotly.js\dist'
I saw there have been problems when using webpack but I haven't found anything gulp related.
I followed this guide to setup and import Plotly: https://plot.ly/javascript/react/
Any help?
The text was updated successfully, but these errors were encountered: