sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

@sentry/nextjs build fails on Yarn PnP mode

Open artechventure opened this issue 5 months ago • 8 comments

Is there an existing issue for this?

  • [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [x] I have reviewed the documentation https://docs.sentry.io/
  • [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/nextjs

SDK Version

8.29.0

Framework Version

Next 14.2.5

Link to Sentry event

No response

Reproduction Example/SDK Setup

https://github.com/getsentry/sentry-javascript/blob/0d79b51e7ecbe26b1b235ed92410d2d07febdcde/packages/nextjs/src/config/webpack.ts#L335

Above part changed 6 months ago, I believe it fails on Yarn PnP since then.

https://github.com/getsentry/sentry-javascript/blob/0d79b51e7ecbe26b1b235ed92410d2d07febdcde/packages/utils/src/node.ts#L57

Inside function loadmodule, node_modules is hard-coded which will always returns undefined

Steps to Reproduce

  1. Setup yarn pnp workspace
  2. Import withSentryConfig from @sentry/nextjs inside next.config.js
  3. Run next build

Expected Result

Build success

Actual Result

TypeError: Cannot destructure property 'sentryWebpackPlugin' of 'utils.loadModule(...)' as it is undefined.

artechventure avatar Sep 10 '24 07:09 artechventure