Title: [BUG]: `events` is required but not declared in dependencies · Issue #8163 · plotly/plotly.js · GitHub
Open Graph Title: [BUG]: `events` is required but not declared in dependencies · Issue #8163 · plotly/plotly.js
X Title: [BUG]: `events` is required but not declared in dependencies · Issue #8163 · plotly/plotly.js
Description: Description src/lib/events.js, src/snapshot/toimage.js and src/snapshot/svgtoimg.js call require('events'), but events is not in the dependencies of package.json. Since webpack 5 no longer polyfills Node.js core modules, the bundler reso...
Open Graph Description: Description src/lib/events.js, src/snapshot/toimage.js and src/snapshot/svgtoimg.js call require('events'), but events is not in the dependencies of package.json. Since webpack 5 no longer polyfill...
X Description: Description src/lib/events.js, src/snapshot/toimage.js and src/snapshot/svgtoimg.js call require('events'), but events is not in the dependencies of package.json. Since webpack 5 no longer ...
Opengraph URL: https://github.com/plotly/plotly.js/issues/8163
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG]: `events` is required but not declared in dependencies","articleBody":"### Description\n\n`src/lib/events.js`, `src/snapshot/toimage.js` and `src/snapshot/svgtoimg.js` call `require('events')`, but `events` is not in the `dependencies` of `package.json`.\n\nSince webpack 5 no longer polyfills Node.js core modules, the bundler resolves `events` to whatever version the package manager happens to hoist.\nToday, it only resolves through a transitive dependency: `regl-scatter2d` → `glslify` → `glslify-deps` → `events`.\nWith strict installs (pnpm with `hoist=false`, Yarn PnP), the build fails.\nWith hoisted installs, another package's `events` can be picked up instead (e.g. `events@1.1.1`).\n\nThis happens with the latest release (4.2.0) and with 2.x.\n`events` is the only Node.js core module still required under `src/` (see also #6014 for older ones).\n\n### Steps to reproduce\n\n`package.json`:\n\n```json\n{\n \"dependencies\": { \"plotly.js\": \"4.2.0\" },\n \"devDependencies\": { \"webpack\": \"5.106.0\", \"webpack-cli\": \"6.0.1\" }\n}\n```\n\n`src/index.js`:\n\n```js\nimport Plotly from \"plotly.js/lib/core\";\nconsole.log(Plotly.version);\n```\n\n```sh\npnpm install --config.hoist=false\nnpx webpack --mode production\n```\n\n```\nERROR in ./node_modules/.pnpm/plotly.js@4.2.0/node_modules/plotly.js/src/lib/events.js 3:19-49\nModule not found: Error: Can't resolve 'events' in '.../node_modules/.pnpm/plotly.js@4.2.0/node_modules/plotly.js/src/lib'\n```\n","author":{"url":"https://github.com/NathanEckert","@type":"Person","name":"NathanEckert"},"datePublished":"2026-11-05T05:06:01Z","url":"https://github.com/plotly/plotly.js/issues/8163"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1559d9a7-c6ec-b623-f4e3-8d6074829baa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D7EA:2E9831:896B87:B59C56:6B01B0F8 |
| html-safe-nonce | 85a27e13e9c4be00793bb199daa8c42d0b37e32409e9cbe240c1d0749fa06cbc |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0VBOjJFOTgzMTo4OTZCODc6QjU5QzU2OjZCMDFCMEY4IiwidmlzaXRvcl9pZCI6IjU5MzMwNzU1MjUzNjYwMzQ2ODAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a7134b428fe512a6cd84906c39a585e062d2cafb9e6e8508bcf94e5fe61536dc |
| hovercard-subject-tag | issue:6217164538 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/plotly/plotly.js/8163/issue_layout |
| twitter:image | https://opengraph.githubassets.com/df81a0d80bd8863a2b5f8868617e6fc0d511b7fa29ca4bc5c1660afd008b1c29/plotly/plotly.js/issues/8163 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/df81a0d80bd8863a2b5f8868617e6fc0d511b7fa29ca4bc5c1660afd008b1c29/plotly/plotly.js/issues/8163 |
| og:image:alt | Description src/lib/events.js, src/snapshot/toimage.js and src/snapshot/svgtoimg.js call require('events'), but events is not in the dependencies of package.json. Since webpack 5 no longer polyfill... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | NathanEckert |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/plotly/plotly.js git https://github.com/plotly/plotly.js.git |
| octolytics-dimension-user_id | 5997976 |
| octolytics-dimension-user_login | plotly |
| octolytics-dimension-repository_id | 45646037 |
| octolytics-dimension-repository_nwo | plotly/plotly.js |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 45646037 |
| octolytics-dimension-repository_network_root_nwo | plotly/plotly.js |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width