plotly.js: [Webpack] Module not found: Error: Can't resolve 'vertx' in '/home/user/app/node_modules/plotly.js/dist'

Error with plotly.js 1.35.1 and webpack 3.11.0 when importing: import Plotly from 'plotly.js/dist/plotly-with-meta'

./node_modules/plotly.js/dist/plotly-with-meta.js
Module not found: Error: Can't resolve 'vertx' in '/home/user/app/node_modules/plotly.js/dist'
 @ ./node_modules/plotly.js/dist/plotly-with-meta.js 61621:16-26
 @ ./src/entryPoint.js
 @ multi ./src/entryPoint.js webpack-hot-middleware/client?path=http://localhost:3000/__webpack_hmr

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 5
  • Comments: 21 (12 by maintainers)

Most upvoted comments

The error is from the es6 promise shim. Discussed here #100 and here #305.

I had to add

new webpack.IgnorePlugin(/vertx/)

to my plugins to squelch the warning. Other things mentioned in the two discussions did not work. I’m still on webpack 3.10 and started getting this when updating to plotly.js 1.35.2 a few days ago.

Just to confirm: this is showing up as a warning, and compilation proceeds, right?

Yes, webpack presents it as a warning and is able to complete the compilation.

@etpinard I didn’t really think it would be, but thought I would note it JIC.

As for reproducible code, here is a codepen. This isn’t exactly what happens in my app, but it is similar. In the pen’s console you’ll see the following on the first button click, but not after that. Error: WebGL warning: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one.

In my app, which uploads a dataset, it prints the following on the third time a dataset is uploaded. WARNING: Too many active WebGL contexts. Oldest context will be lost.

Since v1.35.x, I’am also get a huge warning. It is used in Angular (angular-cli) project:

WARNING in ./node_modules/plotly.js/dist/plotly.js
Module not found: Error: Can't resolve 'vertx' in 'C:\SoftwareProjekte\Hugos\grafioschtrader\grafioschtraderClient\node_modules\plotly.js\dist'
resolve 'vertx' in 'C:\SoftwareProjekte\Hugos\grafioschtrader\grafioschtraderClient\node_modules\plotly.js\dist'
  Parsed request is a module
  using description file: C:\SoftwareProjekte\Hugos\grafioschtrader\grafioschtraderClient\node_modules\plotly.js\package.json (relative path: ./dist)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: C:\SoftwareProjekte\Hugos\grafioschtrader\grafioschtraderClient\node_modules\plotly.js\package.json (relative path: ./dist)
    resolve as module
...

Oh, wow. Now I can’t reproduce it either with that codepen. I’m sorry about that. I guess it must be something specific to application setup. Thanks for looking @etpinard.