Title: @sentry/nextjs Webpack 5 code duplication bug · Issue #3591 · getsentry/sentry-javascript · GitHub
Open Graph Title: @sentry/nextjs Webpack 5 code duplication bug · Issue #3591 · getsentry/sentry-javascript
X Title: @sentry/nextjs Webpack 5 code duplication bug · Issue #3591 · getsentry/sentry-javascript
Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javascript/releases Provide a link to the aff...
Open Graph Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas...
X Description: Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/3591
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@sentry/nextjs Webpack 5 code duplication bug","articleBody":"\u003c!-- Requirements: please go through this checklist before opening a new issue -->\r\n\r\n- [x] Review the documentation: https://docs.sentry.io/\r\n- [x] Search for existing issues: https://github.com/getsentry/sentry-javascript/issues\r\n- [x] Use the latest release: https://github.com/getsentry/sentry-javascript/releases\r\n- [ ] Provide a link to the affected event from your Sentry account\r\n\r\n## Package + Version\r\n\r\n- [ ] `@sentry/browser`\r\n- [ ] `@sentry/node`\r\n- [ ] `raven-js`\r\n- [ ] `raven-node` _(raven for node)_\r\n- [x] other: `@sentry/nextjs`\r\n\r\n### Version:\r\n\r\n```\r\n6.4.1\r\n```\r\n\r\n## Description\r\n\r\nDuring the process of upgrading one of our next.js applications from webpack 4 to webpack 5 I stumbled upon a bug where using `withSentryConfig` causes webpack 5 to duplicate dependencies in the final output. Using the webpack bundle analyzer I can see that packages normally bundled in `_app` also get their own shared bundle\r\n\r\nWithout `withSentryConfig`:\r\n\r\n\u003cimg width=\"1904\" alt=\"Screen Shot 2021-05-24 at 3 31 44 PM\" src=\"https://user-images.githubusercontent.com/1180841/119399604-18689700-bca7-11eb-96ff-d8942c1c0800.png\">\r\n\r\nUsing `withSentryConfig`: (Notice that `@apollo/client` is now included in both `_app` and the `675-` bundle)\r\n\r\n\u003cimg width=\"1904\" alt=\"Screen Shot 2021-05-24 at 3 32 29 PM\" src=\"https://user-images.githubusercontent.com/1180841/119399613-1acaf100-bca7-11eb-8305-0e73664b8157.png\">\r\n\r\nI've created a simple app using the `with-apollo` template that reproduces the issue: https://github.com/pgrippi/sentry-nextjs-code-duplication-bug.\r\n\r\nYou can modify [`next.config.js`, swapping the `module.exports` statements](https://github.com/pgrippi/sentry-nextjs-code-duplication-bug/blob/864ec8cf5605e65da81cc9010a35562b30fdca4f/next.config.js#L8-L17) and running `yarn build` to see the bundle output difference\r\n\r\nTo clarify the issue not limited to `@apollo/client`, it looks like most modules imported from npm that appear in both `_app` and other pages get duplicated, the apollo client is just very noticeable given its large footprint","author":{"url":"https://github.com/pgrippi","@type":"Person","name":"pgrippi"},"datePublished":"2021-05-24T19:53:53Z","url":"https://github.com/getsentry/sentry-javascript/issues/3591"}
| 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:9924507b-dc39-4876-3c03-6ca3c3808d93 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D72:21F6E2:1E6221:2A9910:6B043855 |
| html-safe-nonce | 2713f3dd5db6dbc64c81efb7a2fe2852f38274bf1e69a3751a789105ffe97b4b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDcyOjIxRjZFMjoxRTYyMjE6MkE5OTEwOjZCMDQzODU1IiwidmlzaXRvcl9pZCI6Ijc1MTM3NjI5NDc4ODIzMDE1MjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f0f6bb2b156da4dad7ed7494124395aa5fb87c7edfc6cd1395daa8ca543ef795 |
| hovercard-subject-tag | issue:899957913 |
| 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/getsentry/sentry-javascript/3591/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c7c612e941074e2417516655234e6f3f1b0c89df929795246b3921f6c9b39184/getsentry/sentry-javascript/issues/3591 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c7c612e941074e2417516655234e6f3f1b0c89df929795246b3921f6c9b39184/getsentry/sentry-javascript/issues/3591 |
| og:image:alt | Review the documentation: https://docs.sentry.io/ Search for existing issues: https://github.com/getsentry/sentry-javascript/issues Use the latest release: https://github.com/getsentry/sentry-javas... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pgrippi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| 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 | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width