fix(nextjs): Resolve path for dynamic webpack import
This PR handles the dynamic import of modules using require.resolve instead of a hardcoded node_modules path – allowing the use of alternative node linkers like Yarn PnP
fixes https://github.com/getsentry/sentry-javascript/issues/13641
@chargome l was wondering if this could get brought back to life? As it looks like Sentry v8 for NextJS doesn't work in mono-repos where the node_modules get hoisted
@OllieJennings we're currently busy working on a bigger change in the Next.js SDK, I will re-visit this afterwards (there are still tests failing atm) – I know this is a painful issue if you're working with hoisted dependencies right now
size-limit report 📦
⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.
| Path | Size | % Change | Change |
|---|---|---|---|
| @sentry/browser | 22.76 KB | - | - |
| @sentry/browser - with treeshaking flags | 21.54 KB | - | - |
| @sentry/browser (incl. Tracing) | 35.15 KB | - | - |
| @sentry/browser (incl. Tracing, Replay) | 71.87 KB | - | - |
| @sentry/browser (incl. Tracing, Replay) - with treeshaking flags | 62.29 KB | - | - |
| @sentry/browser (incl. Tracing, Replay with Canvas) | 76.18 KB | - | - |
| @sentry/browser (incl. Tracing, Replay, Feedback) | 88.98 KB | - | - |
| @sentry/browser (incl. Feedback) | 39.9 KB | - | - |
| @sentry/browser (incl. sendFeedback) | 27.4 KB | - | - |
| @sentry/browser (incl. FeedbackAsync) | 32.2 KB | - | - |
| @sentry/react | 25.51 KB | - | - |
| @sentry/react (incl. Tracing) | 38.12 KB | - | - |
| @sentry/vue | 26.9 KB | - | - |
| @sentry/vue (incl. Tracing) | 37.04 KB | - | - |
| @sentry/svelte | 22.9 KB | - | - |
| CDN Bundle | 24.1 KB | - | - |
| CDN Bundle (incl. Tracing) | 36.97 KB | - | - |
| CDN Bundle (incl. Tracing, Replay) | 71.63 KB | - | - |
| CDN Bundle (incl. Tracing, Replay, Feedback) | 76.97 KB | - | - |
| CDN Bundle - uncompressed | 70.66 KB | - | - |
| CDN Bundle (incl. Tracing) - uncompressed | 109.73 KB | - | - |
| CDN Bundle (incl. Tracing, Replay) - uncompressed | 222.25 KB | - | - |
| CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed | 235.46 KB | - | - |
| @sentry/nextjs (client) | 38.2 KB | - | - |
| @sentry/sveltekit (client) | 35.75 KB | - | - |
| @sentry/node | 131.52 KB | - | - |
| @sentry/node - without tracing | 95.64 KB | - | - |
| @sentry/aws-serverless | 105.91 KB | -0.01% | -1 B 🔽 |
:x: 2 Tests Failed:
| Tests completed | Failed | Passed | Skipped |
|---|---|---|---|
| 642 | 2 | 640 | 30 |
View the top 2 failed tests by shortest run time
app-router/rsc-error.test.ts Should capture errors from server componentsStack Traces | 120s run time
rsc-error.test.ts:4:5 Should capture errors from server components
pages-router/client-trace-propagation.test.ts Should propagate traces from server to client in pages routerStack Traces | 120s run time
client-trace-propagation.test.ts:4:5 Should propagate traces from server to client in pages router
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard
@lforst lol this approach worked locally with yarn pnp